wok-tiny annotate busybox/receipt @ rev 175

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