wok-tiny view busybox/receipt @ rev 161

busybox-net: typo in mdev
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 06 11:03:06 2020 +0000 (2020-06-06)
parents 562a49ca00d9
children c21687abfa6a
line source
1 # SliTaz package receipt.
3 PACKAGE="busybox"
4 VERSION="1.28-20170822"
5 GIT_TAG="753c4045e4f287fc4b4788afd94f58738a7f04b4"
6 CATEGORY="base-system"
7 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
8 MAINTAINER="pascal.bellard@slitaz.org"
9 LICENSE="GPL2"
10 [ -n "$TARGET" ] || TARGET="i486"
11 DEPENDS=""
12 BUILD_DEPENDS="bzip2 uclibc-cross-compiler-$TARGET wget"
13 TARBALL="$PACKAGE-$VERSION.tar.bz2"
14 WEB_SITE="http://www.busybox.net/"
15 WGET_URL="https://git.busybox.net/busybox/snapshot/busybox-$GIT_TAG.tar.bz2"
16 AUTO_SELECTION="always"
18 apply_bb_patchs()
19 {
20 cd $src
21 while read file; do
22 [ -f done.$file ] && continue
23 echo "Apply $file..."
24 patch -p1 < $stuff/$PACKAGE-git-$file || return 1
25 touch done.$file
26 done <<EOT
27 stat.u
28 ris.u
29 zmodules.u
30 cmdline.u
31 fbvnc.u
32 cpio.u
33 scriptreplay.u
34 ash.u
35 EOT
36 [ $(. $WOK/linux/receipt; printf "%d%02d%02d" ${VERSION//./ }) -le 20626 ] &&
37 echo apply 0001-mdev-create-devices-from-sys-dev.patch &&
38 patch -p1 -R < $stuff/0001-mdev-create-devices-from-sys-dev.patch
39 cp $stuff/$PACKAGE-git.config .config
40 var="CONFIG_CROSS_COMPILER_PREFIX"
41 sed -i "s/.*$var.*/$var=\"uclibc-$TARGET-\"/" .config
42 }
44 # Rules to configure and make the package.
45 compile_rules()
46 {
47 { apply_bb_patchs &&
48 make oldconfig &&
49 make &&
50 make install
51 } || return 1
52 echo "Chmod 4755 on busybox binary..."
53 chmod 4755 _install/bin/busybox
54 mkdir -p _install/lib
55 LD_LIBRARY_PATH=/usr/share/uclibc-cross-compiler-$TARGET/lib \
56 uclibc-$TARGET-ldd busybox 2> /dev/null | \
57 awk '/=>/ { print $3 }' | while read file ; do
58 cp -a $file _install/lib
59 while [ -L "$file" ]; do
60 dir="$(dirname $file)/"
61 file="$(readlink $file)"
62 case "$file" in
63 /*) ;;
64 *) file="$dir$file";;
65 esac
66 cp -a "$file" _install/lib
67 done
68 done
69 chown 0.0 _install/lib/*
70 }
72 # Rules to gen a SliTaz package suitable for Tazpkg.
73 genpkg_rules()
74 {
75 mkdir $fs/boot $fs/bin $fs/sbin
76 cp -a $WOK/base-tiny/stuff/. $fs/
77 cp -a $src/_install/lib $fs/
78 cp -a $src/_install/bin/busybox $fs/bin
79 for i in /bin/sh /bin/login /bin/false /sbin/mdev /init ; do
80 ln $fs/bin/busybox $fs$i
81 done
82 mkdir -p $fs/etc/init.d
83 # Busybox config files.
84 cp $stuff/busybox.conf $fs/etc
85 chmod 600 $fs/etc/busybox.conf
86 touch $fs/etc/resolv.conf
87 cp $stuff/daemon $fs/etc/init.d
88 for i in crond klogd syslogd ; do
89 grep -qi config_$i=y $src/.config &&
90 ln -s daemon $fs/etc/init.d/$i
91 done
92 sed -i 's|network.sh ||' $fs/etc/rcS.conf
93 sed -i 's|.*Executing all initialization scripts.*|echo -n "Setting hostname..."\
94 hostname -F /etc/hostname\
95 status\n&|' $fs/etc/init.d/rcS
96 rm -f $fs/etc/init.d/network.sh $fs/etc/network.conf \
97 $fs/etc/services $fs/etc/networks $fs/etc/inetd.conf \
98 $fs/etc/host.conf $fs/etc/hosts
100 sed -i '2,$s/^#.*//;/^$/d' $fs/etc/init.d/rc* $fs/etc/init.d/daemon \
101 $fs/etc/init.d/*.sh
102 sed -i 's/^#.*//;/^$/d' $fs/etc/*.conf $fs/etc/*tab \
103 $fs/etc/profile $fs/etc/securetty $fs/etc/shells
104 find $fs -exec touch -r $fs {} \;
105 cp $stuff/busybox-git.config $fs/boot/config-busybox
106 }
108 config_form()
109 {
110 if [ -z "$BBHOST" ]; then
111 [ -n "$PASSWORD" ] || PASSWORD=root
112 [ -n "$BBHOST" ] || BBHOST=slitaz
113 [ -n "$FSTAB" ] || FSTAB='/dev/hda1 /mnt ext3 defaults 0 2'
114 [ -n "$RC_LOCAL" ] || RC_LOCAL='[ -x /mnt/boot/init ] && /mnt/boot/init'
115 fi
116 cat <<EOT
117 <table>
118 <tr>
119 <td>Root password (empty=disable)</td>
120 <td><input type="text" name="PASSWORD" value="$PASSWORD" /></td>
121 </tr>
122 <tr>
123 <td>Host name</td>
124 <td><input type="text" name="BBHOST" value="$BBHOST" /></td>
125 </tr>
126 <tr>
127 <td>Filesystems</td>
128 <td><textarea name="FSTAB" cols="60" wrap="off">
129 $FSTAB
130 </textarea></td>
131 </tr>
132 <tr>
133 <td>Additional boot commands</td>
134 <td><textarea name="RC_LOCAL" cols="60" wrap="off">
135 $RC_LOCAL
136 </textarea></td>
137 </tr>
138 </table>
139 <input type="checkbox" name="KEEP_MODULES" ${KEEP_MODULES:+checked="checked" }/>
140 Do not remove the modules files after loading modules.
141 <p>
142 <input type="checkbox" name="STUPID" ${STUPID:+ckecked="ckecked" }/>
143 Read floppy sector by sector instead of track by track (slow, stupid but safe).
144 EOT
145 }
147 post_install()
148 {
149 chmod 4755 $1/bin/busybox
150 cat >> $1/boot/mkrootfs.pre_exec <<EOT
151 if [ -s modules ]; then
152 while read mod; do
153 sed -i "s/LOAD_MODULES=./&\$mod /" etc/rcS.conf
154 done < modules
155 grep ^LOAD_MODULES= etc/rcS.conf >> etc/packages.conf
156 cp etc/packages.conf boot/packages.conf
157 rm -f modules
158 fi
159 EOT
160 [ "$STUPID" ] && cat >> $1/boot/mkrootfs.pre_exec <<EOT
161 for i in boot/bzImage boot/memtest boot/ipxe; do
162 [ -s \$i ] || continue
163 dd if=\$i bs=512 count=1 | \\
164 sed "s|\$(echo -en '\x64\x66\x8F\x47\x78')|\$(echo -en '\x5E\x5E\x90\x90\x90')|" | \\
165 sed "s|\$(echo -en '\x66\x8F\x47\x78')|\$(echo -en '\x5E\x5E\x90\x90')|" | \\
166 sed "s|\$(echo -en '\x77\x02\xB0\x01')|\$(echo -en '\x90\x90\xB0\x01')|" | \\
167 sed "s|\$(echo -en '\x98\xCD\x13')|\$(echo -en '\x89\x90\x90')|" | \\
168 sed "s|\$(echo -en '\x60\xCD\x13')|\$(echo -en '\x60\x90\x90')|" | \\
169 sed "s|\$(echo -en '\xB0\x31\x1C\x03\xB4\x0E')|\$(echo -en '\xB0\x31\x14\xFD\xB4\x0E')|" | \\
170 dd of=\$i conv=notrunc
171 done
172 EOT
173 sed -i "s/^KEEP_MODULES=\"\"/KEEP_MODULES=\"$KEEP_MODULES\"/" \
174 $1/etc/rcS.conf
175 if [ -n "$PASSWORD" ]; then
176 case "$PASSWORD" in
177 \$1\$*)
178 sed -i "s|^root:[^:]*|root:$PASSWORD|" $1/etc/shadow ;;
179 *)
180 mkdir $1/fs
181 cp -a $1/bin $1/lib $1/etc $1/fs
182 echo "root:$PASSWORD" | chroot $1/fs/ busybox chpasswd -m
183 cp $1/fs/etc/passwd $1/etc/
184 rm -rf $1/fs
185 esac
186 else
187 sed -i 's/^root:[^:]*:/root::/' $1/etc/passwd
188 mkdir $1/root 2> /dev/null
189 cat > $1/root/.profile <<EOT
190 grep -qs ^root:: /etc/passwd /etc/shadow && passwd
191 EOT
192 fi
193 [ -n "$BBHOST" ] && echo $BBHOST > $1/etc/hostname
194 [ -n "$FSTAB" ] && dos2unix >> $1/etc/fstab <<EOT
195 $FSTAB
196 EOT
197 [ -n "$RC_LOCAL" ] && dos2unix >> $1/etc/init.d/local.sh <<EOT
198 $RC_LOCAL
199 EOT
200 }