slitaz-arm annotate rpi/tazbian @ rev 210
tazbian: rpi2+ support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 27 12:20:30 2016 +0200 (2016-03-27) |
parents | 1d2bad01f3d3 |
children | 425bf14d2b84 |
rev | line source |
---|---|
pascal@192 | 1 #!/bin/sh |
pascal@192 | 2 # |
pascal@210 | 3 # (C) 2014-2016 SliTaz GNU/Linux - GPL2 |
pascal@192 | 4 # |
paul@202 | 5 # Creates a Debian package to install SliTaz on a Raspbian without |
paul@202 | 6 # repartitioning. |
pascal@192 | 7 # |
pascal@192 | 8 # AUTHORS: Pascal Bellard <pascal.bellard@slitaz.org> |
pascal@192 | 9 # |
pascal@192 | 10 |
pascal@192 | 11 [ $(id -u) -ne 0 ] && echo "Must be root. Abort." && exit 1 |
pascal@192 | 12 |
pascal@210 | 13 REVISION=2 |
pascal@207 | 14 DESTDIR=var/os/slitaz |
pascal@206 | 15 DESCRIPTION="Tiny Linux distribution with multi boot features" |
pascal@207 | 16 LONG_DESCRIPTION="SliTaz can run fully in RAM or can be installed \ |
pascal@207 | 17 on the SD card in a\nsubdirectory of your Raspbian (example /$DESTDIR)." |
pascal@206 | 18 WEB_SITE="http://arm.slitaz.org/rpi/" |
pascal@206 | 19 MAINTAINER="Pascal Bellard <pascal.bellard@slitaz.org>" |
pascal@206 | 20 |
pascal@205 | 21 tazpkg() |
pascal@205 | 22 { |
pascal@210 | 23 if [ -x /usr/bin/tazpkg -a "$1" == "get-install" ]; then |
pascal@205 | 24 /usr/bin/tazpkg "$@" |
pascal@206 | 25 return $? |
pascal@205 | 26 fi |
pascal@205 | 27 [ "$1" == "get-install" ] && echo "abort: can't find $2" && exit 1 |
pascal@205 | 28 mkdir -p tazpkg$$ |
pascal@205 | 29 cd tazpkg$$ |
pascal@210 | 30 cpio -i < ../$2 > /dev/null 2>&1 |
pascal@205 | 31 gunzip fs.cpio.gz 2> /dev/null |
pascal@205 | 32 [ -s fs.cpio ] || unlzma fs.cpio.lzma |
pascal@210 | 33 cpio -idmu < fs.cpio > /dev/null 2>&1 |
pascal@205 | 34 cd .. |
pascal@205 | 35 sh <<EOT |
pascal@205 | 36 . tazpkg$$/receipt |
pascal@205 | 37 mkdir -p ${3#--root=}/var/lib/tazpkg/installed/\$PACKAGE |
pascal@205 | 38 grep -qs ^pre_install tazpkg$$/receipt && pre_install ${3#--root=} |
pascal@205 | 39 cp -a tazpkg$$/fs/. ${3#--root=} |
pascal@205 | 40 grep -qs ^post_install tazpkg$$/receipt && post_install ${3#--root=} |
pascal@205 | 41 rm -rf tazpkg$$/fs* |
pascal@205 | 42 mv tazpkg$$/* ${3#--root=}/var/lib/tazpkg/installed/\$PACKAGE |
pascal@205 | 43 EOT |
pascal@205 | 44 md5sum $2 >> ${3#--root=}/var/lib/tazpkg/installed.md5 |
pascal@205 | 45 rm -rf tazpkg$$ |
pascal@205 | 46 } |
pascal@205 | 47 |
pascal@206 | 48 buildfs() |
pascal@206 | 49 { |
pascal@192 | 50 CURDIR=$PWD |
pascal@192 | 51 TMPDIR=/tmp/rasp$$ |
pascal@192 | 52 mkdir -p $TMPDIR |
pascal@192 | 53 cd $TMPDIR |
pascal@192 | 54 URL=http://mirror.slitaz.org/arm/rpi/ |
pascal@210 | 55 echo "Read $URL" |
pascal@192 | 56 wget -O - $URL | sed '/slitaz-rpi/!d;s/.*href=.\([a-zA-Z0-9._-]*\).*/\1/' | sort -r > index |
pascal@192 | 57 VERSION="$(sed '/rpi-desktop/!d' index | sed 's/.*-desktop-\([0-9_-]*\).*/\1/;q')" |
pascal@192 | 58 |
pascal@210 | 59 for file in $(sed '/rpi-base/!d;q' index) $(sed '/rpi-desktop/!d;q' index); do |
pascal@210 | 60 echo "Get $file " |
pascal@210 | 61 wget -O - $URL$file | tar xjf - |
pascal@210 | 62 done |
pascal@192 | 63 |
pascal@210 | 64 mkdir -p fs/$DESTDIR fs/boot/slitaz fs/boot/slitaz-base fs/boot/slitaz-live \ |
pascal@206 | 65 fs/boot/$raspos |
pascal@192 | 66 |
pascal@210 | 67 BOOT=$(ls -d slitaz-rpi-base-*/boot) |
pascal@210 | 68 [ ! -d "$BOOT" ] && echo "Abort ($BOOT) !" && exit 1 |
pascal@210 | 69 |
pascal@192 | 70 # setup boot configuration |
pascal@210 | 71 echo "entry=SliTaz $VERSION on SD-card" > fs/boot/slitaz/menu.txt |
pascal@210 | 72 echo "entry=SliTaz base $VERSION in RAM" > fs/boot/slitaz-base/menu.txt |
pascal@210 | 73 echo "entry=SliTaz desktop $VERSION in RAM" > fs/boot/slitaz-live/menu.txt |
pascal@210 | 74 cp $BOOT/config.txt fs/boot/slitaz |
pascal@210 | 75 grep -q ^kernel= fs/boot/slitaz/config.txt || |
pascal@210 | 76 echo "kernel=kernel.img >> fs/boot/slitaz/config.txt" |
pascal@210 | 77 sed -i '/^initramfs/d' fs/boot/slitaz/config.txt |
pascal@210 | 78 cp fs/boot/slitaz/config.txt fs/boot/slitaz-base |
pascal@210 | 79 cp fs/boot/slitaz/config.txt fs/boot/slitaz-live |
pascal@198 | 80 echo "initramfs rootfs-base.gz" >> fs/boot/slitaz/config.txt |
pascal@198 | 81 echo "initramfs ../slitaz/rootfs-base.gz" >> fs/boot/slitaz-base/config.txt |
pascal@210 | 82 echo "initramfs ../slitaz/rootfs-base.gz,../slitaz/rootfs-live.gz" >> fs/boot/slitaz-live/config.txt |
pascal@210 | 83 |
pascal@210 | 84 if [ -s $BOOT/kernel7.img ]; then |
pascal@210 | 85 mv $BOOT/kernel*.img fs/boot/slitaz |
pascal@210 | 86 sed -i 's|kernel.img|../slitaz/&|' fs/boot/slitaz-*/config.txt |
pascal@210 | 87 else |
pascal@210 | 88 rm -rf slitaz-rpi-*/boot/kernel.img \ |
pascal@210 | 89 slitaz-rpi-*/rootfs/lib/modules/* \ |
pascal@210 | 90 slitaz-rpi-*/rootfs/lib/firmware/* |
pascal@210 | 91 sed -i 's|kernel.img|../&|' fs/boot/slitaz-*/config.txt |
pascal@210 | 92 fi |
pascal@192 | 93 |
pascal@192 | 94 # update base package |
pascal@192 | 95 BASE=$(ls -d slitaz-rpi-base-*/rootfs) |
pascal@210 | 96 [ ! -d "$BASE" ] && echo "Abort ($BASE) !" && exit 1 |
pascal@201 | 97 LIVE=$(ls -d slitaz-rpi-desktop-*/rootfs) |
pascal@201 | 98 [ ! -d "$LIVE" ] && echo "Abort ($LIVE) !" && exit 1 |
pascal@201 | 99 LIVESZ=$(du -ks $LIVE | cut -f1) |
pascal@192 | 100 wget http://hg.slitaz.org/slitaz-arm/raw-file/tip/rpi/piboot |
pascal@196 | 101 wget http://hg.slitaz.org/slitaz-boot-scripts/raw-file/tip/init |
pascal@196 | 102 chmod +x piboot init |
pascal@192 | 103 mv piboot $BASE/sbin |
pascal@199 | 104 sed -i 's|mnt /mnt|mnt "/mnt -o noatime"|' init |
pascal@210 | 105 sed -i 's#.*remount,ro#grep -q "tmpfs /mnt tmpfs" /proc/mounts || &#' init |
pascal@200 | 106 mknod -m 660 $BASE/dev/mmcblk0 b 179 0 |
pascal@210 | 107 for i in $(seq 1 5); do |
pascal@210 | 108 mknod -m 660 $BASE/dev/mmcblk0p$i b 179 $i |
pascal@210 | 109 done |
pascal@210 | 110 grep /dev/pts $BASE/etc/fstab || cat >> $BASE/etc/fstab <<EOT |
pascal@210 | 111 devpts /dev/pts devpts rw,gid=5,mode=0620 0 0 |
pascal@210 | 112 EOT |
pascal@210 | 113 |
pascal@210 | 114 [ -s slitaz-rpi-base*/boot/kernel7.img ] || |
pascal@210 | 115 sed -i 's#.*d /proc/sys/dev/cdrom#grep -q subroot= /proc/cmdline || for d in /dev/mmc*p[2-9]; do\n\tumount /mnt\n\tmount -r $d /mnt \&\&\n\tcp -a /mnt/lib/firmware /lib/ \&\&\n\tcp -a /mnt/lib/modules/$(uname -r) /lib/modules/ \&\& break\ndone 2> /dev/null\numount /mnt\n\n&#' init |
pascal@210 | 116 mv init $BASE/rdinit |
pascal@201 | 117 sed -i 's/.*mmcblk0p[2-9].*/# &/;s/noatime/noauto,&/' $BASE/etc/fstab $LIVE/etc/fstab |
pascal@192 | 118 wget http://cook.slitaz.org/cross/arm/packages/packages.list |
pascal@192 | 119 while read file pkg extra ; do |
pascal@192 | 120 [ -s boot$file ] && continue |
pascal@192 | 121 [ -n "$extra" ] && continue |
pascal@192 | 122 pkg=$(grep ^$pkg- packages.list | sort | sed q).tazpkg |
pascal@192 | 123 wget http://cook.slitaz.org/cross/arm/packages/$pkg |
pascal@192 | 124 tazpkg install $pkg --root=$BASE/ |
pascal@192 | 125 done <<EOT |
pascal@192 | 126 /usr/lib/libz.so zlib |
pascal@192 | 127 /usr/sbin/kexec kexec-tools |
pascal@192 | 128 /usr/bin/tset ncursesw |
pascal@192 | 129 /usr/bin/dialog dialog |
pascal@192 | 130 /usr/lib/libxml2.so libxml2 aria2 |
pascal@192 | 131 /usr/bin/gpg-error libgpg-error aria2 |
pascal@192 | 132 /usr/lib/libgcrypt.so libgcrypt aria2 |
pascal@192 | 133 /usr/lib/libgmp.so gmp aria2 |
pascal@192 | 134 /usr/lib/libnettle.so nettle aria2 |
pascal@192 | 135 /usr/lib/libreadline.so readline aria2 |
pascal@196 | 136 /usr/bin/p11-kit p11-kit aria2 |
pascal@192 | 137 /usr/lib/libgnutls.so libgnutls aria2 |
pascal@192 | 138 /usr/lib/libtasn1.so libtasn1 aria2 |
pascal@192 | 139 /usr/bin/gnutls-cli gnutls aria2 |
pascal@192 | 140 /usr/bin/aria2c aria2 aria2 |
pascal@192 | 141 EOT |
pascal@192 | 142 |
pascal@210 | 143 echo "Deduplicate base & live" |
pascal@192 | 144 ( cd $BASE/ ; find ! -type d ) | while read file; do |
pascal@192 | 145 if [ -L $BASE/$file ]; then |
pascal@192 | 146 [ -L $LIVE/$file ] && |
pascal@192 | 147 [ "$(readlink $BASE/$file)" == "$(readlink $LIVE/$file)" ] && |
pascal@192 | 148 rm -f $LIVE/$file |
pascal@192 | 149 elif [ -f $BASE/$file ]; then |
pascal@192 | 150 [ -f $LIVE/$file ] && |
pascal@192 | 151 cmp $BASE/$file $LIVE/$file > /dev/null 2>&1 && |
pascal@192 | 152 rm -f $LIVE/$file |
pascal@192 | 153 elif [ -b $BASE/$file ]; then |
pascal@192 | 154 [ -b $LIVE/$file ] && |
pascal@192 | 155 [ "$(stat -c '%a:%u:%g:%t:%T' $BASE/$file)" == \ |
pascal@192 | 156 "$(stat -c '%a:%u:%g:%t:%T' $LIVE/$file)" ] && |
pascal@192 | 157 rm -f $LIVE/$file |
pascal@192 | 158 elif [ -c $BASE/$file ]; then |
pascal@192 | 159 [ -c $LIVE/$file ] && |
pascal@192 | 160 [ "$(stat -c '%a:%u:%g:%t:%T' $BASE/$file)" == \ |
pascal@192 | 161 "$(stat -c '%a:%u:%g:%t:%T' $LIVE/$file)" ] && |
pascal@192 | 162 rm -f $LIVE/$file |
pascal@192 | 163 fi |
pascal@192 | 164 done |
pascal@192 | 165 ( cd $BASE/ ; find -type d ) | while read dir; do |
pascal@196 | 166 rmdir $LIVE/$dir 2> /dev/null |
pascal@192 | 167 done |
pascal@192 | 168 |
pascal@210 | 169 while read dir suffix ; do |
pascal@210 | 170 echo "Build $suffix archive" |
pascal@210 | 171 ( cd $dir ; find * | cpio -o -H newc ) | if [ -x /usr/bin/zopfli ]; then |
pascal@210 | 172 cat > fs/boot/slitaz/rootfs-$suffix |
pascal@210 | 173 zopfli fs/boot/slitaz/rootfs-$suffix |
pascal@210 | 174 rm -f fs/boot/slitaz/rootfs-$suffix |
pascal@210 | 175 else |
pascal@210 | 176 gzip -9 > fs/boot/slitaz/rootfs-$suffix.gz |
pascal@210 | 177 fi |
pascal@210 | 178 [ -x /usr/bin/advdef ] && advdef -z4 fs/boot/slitaz/rootfs-$suffix.gz |
pascal@210 | 179 r=$(($(stat -c %s fs/boot/slitaz/rootfs-$suffix.gz) % 4)) |
pascal@210 | 180 [ $r -eq 0 ] || dd if=/dev/zero bs=1 count=$((4 - $r)) \ |
pascal@210 | 181 >> fs/boot/slitaz/rootfs-$suffix.gz 2> /dev/null |
pascal@210 | 182 done <<EOT |
pascal@210 | 183 $BASE base |
pascal@210 | 184 $LIVE live |
pascal@210 | 185 EOT |
pascal@206 | 186 } |
pascal@192 | 187 |
pascal@206 | 188 mkpostinst() |
pascal@206 | 189 { |
pascal@206 | 190 cat <<EOT |
pascal@210 | 191 RDEV=\$(sed 's/^\(\|.* \)root=\([^ ]*\).*/\2/' /boot/cmdline.txt) |
pascal@198 | 192 FSTYPE=\$(awk '/ \/ / { if (\$1 != "rootfs") print \$3 }' < /proc/mounts) |
pascal@196 | 193 |
pascal@200 | 194 echo "Extracting /$DESTDIR ..." |
pascal@192 | 195 cd /$DESTDIR |
pascal@192 | 196 zcat /boot/slitaz/rootfs-base.gz | cpio -idmu |
pascal@198 | 197 zcat /boot/slitaz/rootfs-live.gz | cpio -idmu |
pascal@210 | 198 EOT |
pascal@210 | 199 [ -s slitaz-rpi-base*/boot/kernel7.img ] || cat <<EOT |
pascal@210 | 200 echo "Get modules & firmwares ..." |
pascal@210 | 201 cp -a /lib/modules /lib/firmware lib |
pascal@210 | 202 EOT |
pascal@210 | 203 cat <<EOT |
pascal@206 | 204 if ! grep -qs $raspos etc/fstab ; then |
pascal@200 | 205 echo "Update /$DESTDIR/etc/fstab ..." |
pascal@206 | 206 mkdir -p mnt/$raspos |
pascal@200 | 207 sed -i 's/noauto,//' etc/fstab |
pascal@198 | 208 cat >> etc/fstab <<EOM |
pascal@206 | 209 \$RDEV /mnt/$raspos \$FSTYPE noatime 0 0 |
pascal@206 | 210 tmpfs /mnt/$raspos/$DESTDIR tmpfs size=0 0 0 |
pascal@192 | 211 EOM |
pascal@198 | 212 fi |
pascal@201 | 213 cd - > /dev/null |
pascal@192 | 214 |
pascal@210 | 215 if [ ! -f /boot/menu.txt ]; then |
pascal@192 | 216 |
pascal@200 | 217 echo "Update /boot ..." |
pascal@198 | 218 for i in keyboard locale ; do |
pascal@198 | 219 [ -s /etc/default/\$i ] && . /etc/default/\$i |
pascal@192 | 220 done |
pascal@199 | 221 KMAP=\$(find /$DESTDIR/usr/share/kbd/keymaps | grep /\$XKBLAYOUT[.-] | head -n1) |
pascal@199 | 222 [ "\$KMAP" ] && KMAP="kmap=\$(basename \$KMAP .map.gz)" |
pascal@192 | 223 cat > /boot/menu.txt <<EOM |
pascal@192 | 224 title=Raspberry PI boot menu |
pascal@192 | 225 subtitle=Select the OS with ARROW keys and hit RETURN |
pascal@210 | 226 timeout=10 |
pascal@206 | 227 default=$raspos |
pascal@196 | 228 \$KMAP |
pascal@192 | 229 edittitle=Edit menu |
pascal@196 | 230 readonly |
pascal@192 | 231 #noedit |
pascal@196 | 232 #nowebboot |
pascal@196 | 233 #webpath=http://my.home.web.site/pxe/rpi/index.php http://or.this.one/rpi.txt |
pascal@192 | 234 EOM |
pascal@210 | 235 echo "entry=$menustr" > /boot/$raspos/menu.txt |
pascal@198 | 236 KERNEL=\$(sed '/^kernel/!d;s/.*=//' /boot/config.txt) |
pascal@206 | 237 cp /boot/config.txt /boot/cmdline.txt /boot/$raspos/ |
pascal@210 | 238 sed -i '/^initramfs/d' /boot/config.txt |
pascal@210 | 239 echo "initramfs slitaz/rootfs-base.gz" >> /boot/config.txt |
pascal@210 | 240 EOT |
pascal@210 | 241 [ -s slitaz-rpi-base*/boot/kernel7.img ] && cat <<EOT |
pascal@206 | 242 mv /boot/\${KERNEL:-kernel.img} /boot/$raspos/ |
pascal@210 | 243 sed -i '/^kernel/d' /boot/config.txt |
pascal@192 | 244 echo "kernel=slitaz/kernel.img" >> /boot/config.txt |
pascal@210 | 245 EOT |
pascal@210 | 246 cat <<EOT |
pascal@196 | 247 L= |
pascal@210 | 248 for i in \$LANG \${LANG%.*} \${LANG%@*} \${LANG%_*} ; do |
pascal@210 | 249 [ -s /$DESTDIR/usr/share/i18n/locales/\$i ] && L=lang=\$i |
pascal@210 | 250 done |
pascal@210 | 251 TZ=\$(cat /etc/timezone 2> /dev/null || true) |
pascal@210 | 252 X="\$L \$KMAP \${TZ:+tz=\$TZ} quiet" |
pascal@210 | 253 echo "\$(cat /boot/cmdline.txt) \$X rdinit=/sbin/piboot" > /boot/cmdline.txt |
pascal@210 | 254 echo "root=/dev/null \$X rdinit=/rdinit mount=\$RDEV subroot=$DESTDIR rootwait" > /boot/slitaz/cmdline.txt |
pascal@210 | 255 echo "root=/dev/null \$X" > /boot/slitaz-base/cmdline.txt |
pascal@192 | 256 cp /boot/slitaz-base/cmdline.txt /boot/slitaz-live/cmdline.txt |
pascal@207 | 257 echo "The SliTaz boot menu is available for the next (re)boot." |
pascal@192 | 258 |
pascal@192 | 259 fi |
pascal@206 | 260 EOT |
pascal@206 | 261 } |
pascal@206 | 262 |
pascal@206 | 263 mkpurge() |
pascal@206 | 264 { |
pascal@206 | 265 cat <<EOT |
pascal@206 | 266 echo "Remove /$DESTDIR & /boot/slitaz* trees..." |
pascal@206 | 267 rm -rf /$DESTDIR /boot/slitaz* |
pascal@206 | 268 EOT |
pascal@206 | 269 } |
pascal@206 | 270 |
pascal@206 | 271 mkdisable() |
pascal@206 | 272 { |
pascal@206 | 273 cat <<EOT |
pascal@206 | 274 if [ -d /boot/$raspos ]; then |
pascal@206 | 275 echo "Restore $raspos boot files..." |
pascal@206 | 276 rm -f /boot/$raspos/menu.txt |
pascal@206 | 277 mv -f /boot/$raspos/* /boot |
pascal@210 | 278 rmdir /boot/$raspos |
pascal@206 | 279 fi |
pascal@206 | 280 rm -f /boot/menu.txt /boot/slitaz*/cmdline.txt |
pascal@206 | 281 EOT |
pascal@206 | 282 } |
pascal@206 | 283 |
pascal@206 | 284 pkgdebian() |
pascal@206 | 285 { |
pascal@206 | 286 # Create raspbian package |
pascal@206 | 287 echo "2.0" > debian-binary |
pascal@206 | 288 cat > control <<EOT |
pascal@206 | 289 Package: slitaz |
pascal@210 | 290 Version: $VERSION-$REVISION |
pascal@206 | 291 Architecture: armhf |
pascal@206 | 292 Maintainer: $MAINTAINER |
pascal@206 | 293 Installed-Size: $(($(du -ks fs | cut -f1) + $LIVESZ)) |
pascal@206 | 294 Section: miscellaneous |
pascal@206 | 295 Priority: optional |
pascal@206 | 296 Homepage: $WEB_SITE |
pascal@206 | 297 Description: $DESCRIPTION |
pascal@210 | 298 $(echo -e $LONG_DESCRIPTION | sed 's/^/ /') |
pascal@206 | 299 EOT |
pascal@206 | 300 ( cd fs ; find * -type f -exec md5sum {} \; ) > md5sums |
pascal@206 | 301 cat > postinst <<EOT |
pascal@206 | 302 #!/bin/sh |
pascal@206 | 303 |
pascal@206 | 304 set -e |
pascal@206 | 305 |
pascal@206 | 306 $(mkpostinst) |
pascal@196 | 307 |
pascal@192 | 308 exit 0 |
pascal@192 | 309 EOT |
pascal@206 | 310 cat > prerm <<EOT |
pascal@192 | 311 #!/bin/sh |
pascal@192 | 312 |
pascal@192 | 313 purge() |
pascal@192 | 314 { |
pascal@206 | 315 $(mkpurge) |
pascal@192 | 316 } |
pascal@192 | 317 |
pascal@192 | 318 disable() |
pascal@192 | 319 { |
pascal@206 | 320 $(mkdisable) |
pascal@192 | 321 } |
pascal@192 | 322 |
pascal@192 | 323 case "\$1" in |
pascal@192 | 324 purge) |
pascal@192 | 325 disable |
pascal@192 | 326 purge |
pascal@192 | 327 ;; |
pascal@192 | 328 remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) |
pascal@192 | 329 disable |
pascal@192 | 330 ;; |
pascal@192 | 331 *) |
pascal@201 | 332 echo "prerm called with unknown argument \\\`\$1'" >&2 |
pascal@192 | 333 exit 0 |
pascal@192 | 334 esac |
pascal@192 | 335 EOT |
pascal@206 | 336 chmod +x postinst prerm |
pascal@206 | 337 tar czf control.tar.gz md5sums control postinst prerm |
pascal@206 | 338 rm -rf fs/$DESTDIR/* |
pascal@206 | 339 cd fs ; tar czf ../data.tar.gz . ; cd .. |
pascal@210 | 340 ar rcs slitaz-$VERSION-${REVISION}_armhf.deb debian-binary control.tar.gz data.tar.gz |
pascal@210 | 341 mv slitaz-$VERSION-${REVISION}_armhf.deb $CURDIR |
pascal@206 | 342 cd $CURDIR |
pascal@206 | 343 rm -rf $TMPDIR |
pascal@210 | 344 ls -l slitaz-$VERSION-${REVISION}_armhf.deb |
pascal@206 | 345 } |
pascal@206 | 346 |
pascal@206 | 347 mkmtree() |
pascal@206 | 348 { |
pascal@206 | 349 echo "#mtree" |
pascal@206 | 350 echo "/set type=file uid=0 gid=0 mode=644" |
pascal@206 | 351 find .??* * | while read file; do |
pascal@206 | 352 echo -n "$file $(stat -c "time=%Y.000000" "$file")" |
pascal@206 | 353 n="$(stat -c "%a" "$file")"; [ "$n" == "644" ] || echo -n " mode=$n" |
pascal@206 | 354 n="$(stat -c "%u" "$file")"; [ "$n" == "0" ] || echo -n " uid=$n" |
pascal@206 | 355 n="$(stat -c "%g" "$file")"; [ "$n" == "0" ] || echo -n " gid=$n" |
pascal@206 | 356 if [ -f "$file" ]; then |
pascal@206 | 357 echo -n " $(stat -c "size=%s" "$file")" |
pascal@206 | 358 echo -n " md5digest=$(md5sum "$file" | sed 's/ .*//')" |
pascal@206 | 359 echo -n " sha256digest=$(sha256sum "$file" | sed 's/ .*//')" |
pascal@206 | 360 fi |
pascal@206 | 361 [ -d "$file" ] && echo -n " type=dir" |
pascal@206 | 362 echo "" |
pascal@206 | 363 done |
pascal@206 | 364 } |
pascal@206 | 365 |
pascal@206 | 366 pkgarch() |
pascal@206 | 367 { |
pascal@206 | 368 cd fs |
pascal@210 | 369 VERSION=$VERSION-$REVISION |
pascal@206 | 370 # Create arch package |
pascal@206 | 371 cat > .PKGINFO <<EOT |
pascal@206 | 372 pkgname = slitaz |
pascal@206 | 373 pkgver = $VERSION |
pascal@206 | 374 pkgdesc = $DESCRIPTION |
pascal@206 | 375 url = $WEB_SITE |
pascal@206 | 376 builddate = $(date +%s) |
pascal@206 | 377 packager = $MAINTAINER |
pascal@206 | 378 size = $(du -s . | awk "{ print \$1*1024+$LIVESZ }") |
pascal@206 | 379 arch = armv6h |
pascal@206 | 380 license = GPL |
pascal@206 | 381 EOT |
pascal@206 | 382 cat > .INSTALL <<EOT |
pascal@206 | 383 post_install() { |
pascal@206 | 384 $(mkpostinst) |
pascal@206 | 385 } |
pascal@206 | 386 |
pascal@206 | 387 post_remove() { |
pascal@206 | 388 $(mkdisable) |
pascal@206 | 389 $(mkpurge) |
pascal@206 | 390 } |
pascal@206 | 391 EOT |
pascal@206 | 392 mkmtree | gzip -9 > ../.MTREE |
pascal@206 | 393 mv ../.MTREE . |
pascal@206 | 394 tar cvzf ../slitaz-$VERSION-armv6h.pkg.tar.gz .??* * |
pascal@206 | 395 mv ../slitaz-$VERSION-armv6h.pkg.tar.gz $CURDIR |
pascal@206 | 396 cd $CURDIR |
pascal@206 | 397 rm -rf $TMPDIR |
pascal@206 | 398 ls -l slitaz-$VERSION-armv6h.pkg.tar.gz |
pascal@206 | 399 } |
pascal@206 | 400 |
pascal@206 | 401 case "$(basename $0)" in |
pascal@206 | 402 tazarch) |
pascal@206 | 403 raspos=archarm |
pascal@210 | 404 menustr="Arch Linux ARM \$(uname -r)" |
pascal@206 | 405 buildfs |
pascal@206 | 406 pkgarch |
pascal@206 | 407 ;; |
pascal@206 | 408 *) |
pascal@206 | 409 [ -x /usr/bin/ar -o -x /bin/ar ] || tazpkg get-install binutils |
pascal@206 | 410 raspos=raspbian |
pascal@210 | 411 menustr="Raspbian \$(cat /etc/debian_version)" |
pascal@206 | 412 buildfs |
pascal@206 | 413 pkgdebian |
pascal@206 | 414 ;; |
pascal@206 | 415 esac |