File: diskless-image-secure.preinst

package info (click to toggle)
diskless 0.3.6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 460 kB
  • ctags: 111
  • sloc: perl: 2,467; sh: 375; makefile: 104
file content (48 lines) | stat: -rw-r--r-- 1,330 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh -e

warn() {
	cat <<@EOF

              DISKLESS IMAGE 1.3 INSTALLATION ERROR

You are attempting to install the diskless image package onto a
filesystem that doesn't look like a diskless NFS-root image. This could
result in your computer being unable to boot, because this package is
only designed for a specific purpose. In particular, installing
this package could break your /sbin/init daemon.

It is not intended that this package ever be manually installed. Rather,
the diskless-newimage script, contained in the diskless package should
be used. If you have used this script, but still get this message, then
you have found a bug. Please report it.

Aborting installation...
@EOF
	exit 1
}

if [ ! -d /etc/diskless-image ]; then
	warn
fi
   
#DEBHELPER#

#if [ install = "$1" ]; then
    dpkg-divert --package diskless-image-secure --add --rename \
                --divert /sbin/init.orig /sbin/init
    dpkg-divert --package diskless-image-secure --add --rename \
                --divert /usr/man/man8/init.orig.8.gz /usr/man/man8/init.8.gz
#fi

if [ ! -d /rw ]; then
	echo -n "Symlinking directories into /rw:";
	mkdir /rw
	chmod 755 /rw
	echo -n " /dev"
	mv /dev /rw/dev; ln -s rw/dev /dev
	echo -n " /var"
	mv /var /rw/var; ln -s rw/var /var
	echo -n " /tmp"
	mv /tmp /rw/tmp; ln -s rw/tmp /tmp
	echo "."
fi