File: preinst

package info (click to toggle)
usbmount 0.0.10
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 76 kB
  • ctags: 2
  • sloc: sh: 185; makefile: 1
file content (28 lines) | stat: -rw-r--r-- 833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -e

# If the package is upgraded from a version before 0.0.10,
# move /etc/usbmount.conf to /etc/usbmount/usbmount.conf.
if test "$1" = upgrade || test "$1" = install; then
    if test -n "$2" && dpkg --compare-versions "$2" lt 0.0.10 \
	&& test -f /etc/usbmount.conf \
	&& ! test -e /etc/usbmount/usbmount.conf; then
	test -d /etc/usbmount || mkdir /etc/usbmount
	echo Moving /etc/usbmount.conf to /etc/usbmount/usbmount.conf ...
	mv /etc/usbmount.conf /etc/usbmount/usbmount.conf
    fi
fi

# If the package is installed, try to create the default mountpoints.
# Failure to do so is not considered fatal.
if test "$1" = install; then
    mkdir /media 2> /dev/null || :
    for i in 0 1 2 3 4 5 6 7; do
	mkdir /media/usb$i 2> /dev/null || :
    done
    ln -s usb0 /media/usb 2> /dev/null || :
fi

#DEBHELPER#

exit 0