slitaz-arm annotate rpi/tazbian @ rev 219

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