wok-current view slitaz-boot-scripts/receipt @ rev 1137

Fix post_install for subdir install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 24 12:27:06 2008 +0000 (2008-07-24)
parents 4ae1b641e09a
children c3027d83478d
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-boot-scripts"
4 VERSION="2.5"
5 CATEGORY="base-system"
6 SHORT_DESC="Provide all the initialisation scripts used at boot time."
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/boot-scripts/$TARBALL"
12 # Rules to gen a SliTaz package suitable for Tazpkg.
13 #
14 # This package is all build by genpkg, it provide the boot scripts found
15 # in /etc/init.d with the main config file : /etc/rcS.conf. It provide also
16 # the default inittab and the network config file used with network.sh
17 #
18 genpkg_rules()
19 {
20 mkdir -p $fs/usr/share
21 cp -a $src/etc $fs
22 cp -a $src/applications $fs/usr/share
24 # Perms
25 chown -R root.root $fs/etc/init.d
26 chmod 755 $fs/etc/init.d/*.sh
27 chmod 755 $fs/etc/init.d/rc*
28 }
30 # Pre install commands.
31 #
32 pre_install()
33 {
34 local root
35 root=$1
37 # Backup file to restore with post install
38 echo "Creating backups of configs..."
39 cp $root/etc/rcS.conf $root/etc/rcS.conf.bak 2>/dev/null
40 cp $root/etc/network.conf $root/etc/network.conf.bak 2>/dev/null
41 cp $root/etc/inittab $root/etc/inittab.bak 2>/dev/null
42 cp $root/etc/init.d/local.sh $root/etc/init.d/local.sh.bak 2>/dev/null
43 }
45 post_install()
46 {
47 local root
48 root=$1
49 ( cd $1/ ; cpio -o -H newc | gzip -9 ) > \
50 $1/$INSTALLED/$PACKAGE/volatile.cpio.gz <<EOT
51 etc/rcS.conf
52 etc/network.conf
53 EOT
54 echo "Restoring configs backups..."
55 mv -f $root/etc/rcS.conf.bak $root/etc/rcS.conf 2>/dev/null
56 mv -f $root/etc/network.conf.bak $root/etc/network.conf 2>/dev/null
57 mv -f $root/etc/inittab.bak $root/etc/inittab 2>/dev/null
58 mv -f $root/etc/init.d/local.sh.bak $root/etc/init.d/local.sh 2>/dev/null
60 # wifi config
61 if ! grep -q ^WIFI $root/etc/network.conf; then
62 cat >> $root/etc/network.conf << "EOT"
63 # Wifi connection.
64 # Enable/disable wireless connection at boot time.
65 WIFI="no"
67 # Wifi interface (iwconfig) and ESSID.
68 WIFI_INTERFACE="wlan0"
69 WIFI_ESSID="any"
70 WIFI_MODE="managed"
71 WIFI_KEY=""
72 WIFI_KEY_TYPE="none"
73 WPA_DRIVER=""
74 WIFI_CHANNEL=""
75 WIFI_IWCONFIG_ARGS=""
76 NDISWRAPPER_DRIVERS=""
78 EOT
79 fi
80 # From 2.3 default user have uid=1000 (standard), so change hacker
81 # id/group and chown.
82 if grep -q "500:500" $root/etc/passwd; then
83 sed -i s/'500:500'/'1000:1000'/ $root/etc/passwd
84 sed -i s/'500'/'1000'/ $root/etc/group
85 chown -R 1000.1000 $root/home/hacker
86 fi
87 }
89 repack_cleanup()
90 {
91 zcat $INSTALLED/$PACKAGE/volatile.cpio.gz | ( cd $1 ; cpio -id )
92 }