wok-current view slitaz-base-files/receipt @ rev 24069

Add some current_version()
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jul 06 11:01:20 2021 +0000 (2021-07-06)
parents b6120eeb6704
children 5926178cd6fa
line source
1 # SliTaz package receipt.
3 PACKAGE="slitaz-base-files"
4 VERSION="343"
5 CATEGORY="base-system"
6 SHORT_DESC="Linux tree and the necessary files for the base system."
7 MAINTAINER="pankso@slitaz.org"
8 LICENSE="BSD GPL3"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://www.slitaz.org/"
11 WGET_URL="http://hg.slitaz.org/$PACKAGE/archive/$VERSION.tar.gz"
12 HOST_ARCH="i486 arm"
14 DEPENDS="gettext-base"
16 CONFIG_FILES="\
17 /etc/adduser.conf \
18 /etc/passwd \
19 /etc/fstab \
20 /etc/issue \
21 /etc/hosts \
22 /etc/host.conf \
23 /etc/hostname \
24 /etc/group \
25 /etc/daemons.conf \
26 /etc/nsswitch.conf \
27 /etc/networks \
28 /etc/profile \
29 /etc/securetty \
30 /etc/services \
31 /etc/shells \
32 /etc/motd \
33 /etc/slitaz-release \
34 /etc/slitaz/slitaz.conf \
35 /etc/sysctl.conf"
37 SECRET_FILES="\
38 /etc/gshadow \
39 /etc/shadow"
41 current_version()
42 {
43 wget -O - http://hg.slitaz.org/$PACKAGE/ 2>/dev/null | \
44 sed '/^Changeset/!d;s|.*">|http://hg.slitaz.org/'$PACKAGE'/rev/|;s|<.*||' | \
45 xargs wget -O - 2>/dev/null | sed '/rev /!d;s|.*rev ||;s| .*||'
46 }
48 # Rules to configure and make the package.
49 compile_rules()
50 {
51 make DESTDIR=$DESTDIR install
52 }
54 # Rules to gen a SliTaz package suitable for Tazpkg.
55 genpkg_rules()
56 {
57 mkdir -p \
58 $fs/bin \
59 $fs/dev \
60 $fs/home \
61 $fs/media/cdrom \
62 $fs/media/flash \
63 $fs/media/usbdisk \
64 $fs/mnt \
65 $fs/proc \
66 $fs/root \
67 $fs/run \
68 $fs/sbin \
69 $fs/sys \
70 $fs/tmp \
71 $fs/usr/bin \
72 $fs/usr/games \
73 $fs/usr/lib \
74 $fs/usr/sbin \
75 $fs/usr/share/doc \
76 $fs/var/cache \
77 $fs/var/games \
78 $fs/var/lib \
79 $fs/var/lock \
80 $fs/var/log/slitaz \
81 $fs/var/spool \
82 $fs/var/tmp \
83 $fs/var/run
85 # Daemons may store the pid files in /var/run
86 # from 5.0 /var/run is mounted as tmpfs
87 #ln -s /run $fs/var/run
89 # Copy all installed files and set permissions.
90 cp -a $install/* $fs
92 chown -R root.root $fs/*
93 chmod 1777 $fs/tmp
94 chmod 640 $fs/etc/shadow
95 chmod 640 $fs/etc/gshadow
96 chmod 0750 $fs/root
98 # Populate /dev with $fs/sbin/mktazdevs.sh.
99 $fs/sbin/mktazdevs.sh $fs/dev
101 # Create /etc/mtab symlink.
102 cd $fs/etc
103 ln -s /proc/mounts mtab
105 # Fix httphelper link
106 cd $fs/usr/lib/slitaz
107 ln -s httphelper.sh httphelper
109 # Update copyright year
110 grep -rl 'copy; 2' $fs/var/www | xargs \
111 sed -i "s/copy; [0-9]*/copy; $(date +%Y)/"
112 }
114 # Pre and post install to backup all /etc/settings
115 #
116 pre_install()
117 {
118 for i in passwd shadow group gshadow ; do
119 [ -s /etc/$i ] && cp /etc/$i /etc/$i.orig
120 done
121 [ -x "$1/usr/bin/sudo" ] && mv "$1/usr/bin/sudo" "$1/usr/bin/sudo.orig"
122 # Remove old /var/run symlink
123 [ -h "$1/var/run" ] && rm -f "$1/var/run"
124 :
125 }
127 post_install()
128 {
129 for i in passwd shadow group gshadow ; do
130 [ -s $1/etc/$i.orig ] || continue
131 while read line; do
132 grep -q "^${line%%:*}:" $1/etc/$i.orig || echo "$line" >> $1/etc/$i.orig
133 done < $1/etc/$i
134 mv -f $1/etc/$i.orig $1/etc/$i
135 done
137 [ -x "$1/usr/bin/sudo.orig" ] && mv -f "$1/usr/bin/sudo.orig" "$1/usr/bin/sudo"
139 # Reset permission.
140 chmod 640 "$1/etc/shadow"
141 chmod 640 "$1/etc/gshadow"
143 if ! grep -q audio "$1/etc/group"; then
144 chroot "$1/" /bin/addgroup -g 20 audio
145 fi
146 sed -i "s|content: \"20..\"|content: \"$(date +%Y)\"|" \
147 $1/usr/share/doc/slitaz-doc.css
148 }
150 pre_remove()
151 {
152 # We can not remove this package!
153 exit 1
154 }