wok-next view slitaz-boot-scripts/receipt @ rev 2306

lighttpd: backup config files
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 24 23:20:43 2009 +0100 (2009-02-24)
parents bd6010223726
children abd9e3167576
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-boot-scripts"
4 VERSION="2.6.1"
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"
11 CONFIG_FILES="/etc/inittab /etc/init.d/local.sh /etc/rcS.conf /etc/network.conf"
13 # Rules to gen a SliTaz package suitable for Tazpkg.
14 #
15 # This package is all build by genpkg, it provide the boot scripts found
16 # in /etc/init.d with the main config file : /etc/rcS.conf. It provide also
17 # the default inittab and the network config file used with network.sh
18 #
19 genpkg_rules()
20 {
21 mkdir -p $fs/usr/share $fs/etc/X11
22 cp -a $src/etc $fs
23 cp -a $src/applications $fs/usr/share
25 # Perms
26 chown -R root.root $fs/etc/init.d
27 chmod 755 $fs/etc/init.d/*.sh
28 chmod 755 $fs/etc/init.d/rc*
29 }
31 # Pre install commands.
32 #
33 pre_install()
34 {
35 local root
36 root=$1
38 # Backup file to restore with post install
39 echo "Creating backups of configs..."
40 cp $root/etc/rcS.conf $root/etc/rcS.conf.bak 2>/dev/null
41 cp $root/etc/network.conf $root/etc/network.conf.bak 2>/dev/null
42 cp $root/etc/inittab $root/etc/inittab.bak 2>/dev/null
43 cp $root/etc/init.d/local.sh $root/etc/init.d/local.sh.bak 2>/dev/null
44 }
46 post_install()
47 {
48 local root
49 root=$1
50 echo "Restoring configs backups..."
51 mv -f $root/etc/rcS.conf.bak $root/etc/rcS.conf 2>/dev/null
52 mv -f $root/etc/network.conf.bak $root/etc/network.conf 2>/dev/null
53 mv -f $root/etc/inittab.bak $root/etc/inittab 2>/dev/null
54 mv -f $root/etc/init.d/local.sh.bak $root/etc/init.d/local.sh 2>/dev/null
56 # wifi config
57 if ! grep -q ^WIFI $root/etc/network.conf; then
58 cat >> $root/etc/network.conf << "EOT"
59 # Wifi connection.
60 # Enable/disable wireless connection at boot time.
61 WIFI="no"
63 # Wifi interface (iwconfig) and ESSID.
64 WIFI_INTERFACE="wlan0"
65 WIFI_ESSID="any"
66 WIFI_MODE="managed"
67 WIFI_KEY=""
68 WIFI_KEY_TYPE="none"
69 WPA_DRIVER=""
70 WIFI_CHANNEL=""
71 WIFI_IWCONFIG_ARGS=""
72 NDISWRAPPER_DRIVERS=""
74 EOT
75 fi
76 # From 2.3 default user have uid=1000 (standard), so change hacker
77 # id/group and chown.
78 if grep -q "500:500" $root/etc/passwd; then
79 sed -i s/'500:500'/'1000:1000'/ $root/etc/passwd
80 sed -i s/'500'/'1000'/ $root/etc/group
81 chown -R 1000.1000 $root/home/hacker
82 fi
83 }