wok-current view slitaz-base-files/receipt @ rev 1084
Fix backup for repack_cleanup in post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 16 15:42:10 2008 +0000 (2008-07-16) |
parents | ff5b2bafde86 |
children | 2120530d4ada |
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-base-files"
4 VERSION="2.3"
5 CATEGORY="base-system"
6 SHORT_DESC="Linux tree and the necessary files for the base system."
7 MAINTAINER="pankso@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.slitaz.org/"
10 WGET_URL="http://mirror.slitaz.org/sources/base-files/$TARBALL"
12 # Rules to gen a SliTaz package suitable for Tazpkg.
13 genpkg_rules()
14 {
15 mkdir -p \
16 $fs/bin \
17 $fs/dev \
18 $fs/home \
19 $fs/media/cdrom \
20 $fs/media/flash \
21 $fs/media/usbdisk \
22 $fs/mnt \
23 $fs/proc \
24 $fs/root \
25 $fs/sbin \
26 $fs/sys \
27 $fs/tmp \
28 $fs/usr/bin \
29 $fs/usr/games \
30 $fs/usr/lib \
31 $fs/usr/local \
32 $fs/usr/sbin \
33 $fs/usr/share/doc \
34 $fs/var/cache \
35 $fs/var/games \
36 $fs/var/lib \
37 $fs/var/lock \
38 $fs/var/log \
39 $fs/var/run \
40 $fs/var/spool \
41 $fs/var/tmp
43 # Copy all rootfs from the stuff and set permissions.
44 cp -a $src/rootfs/* $fs
46 chown -R root.root $fs/*
47 chmod 1777 $fs/tmp
48 chmod 640 $fs/etc/shadow
49 chmod 640 $fs/etc/gshadow
50 chmod 0750 $fs/root
52 # Populate /dev with /$fs/sbin/mktazdevs.sh.
53 ./$fs/sbin/mktazdevs.sh $fs/dev
55 # Creat /etc/mtab symlink.
56 cd $fs/etc
57 ln -s /proc/mounts mtab
58 }
60 # Pre and post install to backup all /etc/settings
61 #
62 pre_install()
63 {
64 local root
65 root=$1
66 echo "Creating backup of all files in /etc..."
67 cp -a $root/etc $root/tmp/etc.bak 2>/dev/null
68 }
70 post_install()
71 {
72 local root
73 root=$1
74 ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
75 $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
76 etc/passwd
77 etc/fstab
78 etc/hosts
79 etc/hostname
80 etc/group
81 etc/gshadow
82 etc/shadow
83 etc/daemons.conf
84 etc/nsswitch.conf
85 etc/networks
86 EOT
87 echo "Restoring files from /etc/etc.bak..."
88 cp -a $root/tmp/etc.bak/* $root/etc 2>/dev/null
89 rm -rf $root/tmp/etc.bak
91 # Reset permission.
92 chmod 640 $root/etc/shadow
93 chmod 640 $root/etc/gshadow
95 if ! grep -q audio $root/etc/group; then
96 if [ -n "$root" ]; then
97 cp /etc/group $root/etc/group
98 else
99 addgroup -g 20 audio
100 fi
101 fi
103 # daemons.conf (tftp + dnsd)
104 if ! grep -q ^TFTPD_OPTIONS $root/etc/daemons.conf; then
105 echo '# Tftp daemon options.' >> $root/etc/daemons.conf
106 echo 'TFTPD_OPTIONS="-r /boot"' >> $root/etc/daemons.conf
107 echo '' >> $root/etc/daemons.conf
108 fi
109 if ! grep -q ^DNSD_OPTIONS $root/etc/daemons.conf; then
110 echo '# Domain name server options.' >> $root/etc/daemons.conf
111 echo 'DNSD_OPTIONS="-d"' >> $root/etc/daemons.conf
112 echo '' >> $root/etc/daemons.conf
113 fi
114 }
115 SELF_INSTALL=1
117 repack_cleanup()
118 {
119 zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
120 }