wok annotate slitaz-base-files/receipt @ rev 1713

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