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