tazlito view tazlito @ rev 21

Allow to use gzip via config file
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Dec 17 16:45:56 2007 +0000 (2007-12-17)
parents 3f99b39ad0f4
children 8c53c4a8db66
line source
1 #!/bin/sh
2 # TazLito - SliTaz Live Tool.
3 #
4 # Tazlito is a tool to help generating and configuring SliTaz LiveCD
5 # ISO images. You can creat a custom distro in one command from a list of
6 # packages, extract a existing ISO image to hack it, creat new initramfs
7 # and/or new ISO. Most commands must be run by root, expect the stats
8 # and the configuration file manipulation.
9 #
10 # (C) 2007 SliTaz - GNU General Public License.
11 # Initial author : <pankso@slitaz.org>
12 #
13 VERSION=1.2
15 # Tazlito configuration variables to be shorter
16 # and to use words rater than numbers.
17 COMMAND=$1
18 LIST_NAME=$2
19 TMP_DIR=/tmp/tazlito-$$-$RANDOM
20 TMP_MNT=/media/tazlito-$$-$RANDOM
21 TOP_DIR=`pwd`
22 INITRAMFS=rootfs.gz
23 LOCALSTATE=/var/lib/tazpkg
24 INSTALLED=$LOCALSTATE/installed
25 CACHE_DIR=/var/cache/tazpkg
26 MIRROR=$LOCALSTATE/mirror
28 # Try to include config file, continue if command is gen-config or exit.
29 # The main config used by default is in /etc/tazlito.
30 if [ -f "/etc/tazlito/tazlito.conf" ] ; then
31 CONFIG_FILE="/etc/tazlito/tazlito.conf"
32 fi
33 # Specific distro config file can be put in a distro tree.
34 if [ -f "$TOP_DIR/tazlito.conf" ] ; then
35 CONFIG_FILE="$TOP_DIR/tazlito.conf"
36 fi
37 if [ ! "$CONFIG_FILE" = "" ] ; then
38 . $CONFIG_FILE
39 else
40 if [ "$COMMAND" = "gen-config" ] ; then
41 continue
42 else
43 echo "Unable to find any configuration file. Please read the doc"
44 echo "or run '`basename $0` gen-config' to get an empty config file."
45 exit 0
46 fi
47 fi
49 # Set the rootfs and rootcd path with $DISTRO
50 # configuration variable.
51 ROOTFS=$DISTRO/rootfs
52 ROOTCD=$DISTRO/rootcd
54 #####################
55 # Tazlito functions #
56 #####################
58 # Print the usage.
59 usage ()
60 {
61 echo -e "\nSliTaz Live Tool - Version: $VERSION\n
62 \033[1mUsage: \033[0m `basename $0` [command] [list|iso] [dir]
63 \033[1mCommands: \033[0m\n
64 usage Print this short usage.
65 stats View Tazlito and distro configuration statistics.
66 gen-config Generate a new configuration file for a distro.
67 configure Configure the main config file or a specific tazlito.conf.
68 gen-iso Generate a new ISO from a distro tree.
69 gen-initiso Generate a new initramfs and ISO from the distro tree.
70 extract-distro Extract and ISO to a directory and rebuild LiveCD tree.
71 gen-distro Generated a Live distro and ISO from a list of packages.
72 clean-distro Remove all files generated by gen-distro.
73 addhacker Add Linux User Hacker to the current distro.
74 check-distro Help to check if distro is ready to release.
75 burn-iso Burn ISO image to a cdrom using Wodim.\n"
76 }
78 # Status function.
79 status()
80 {
81 local CHECK=$?
82 echo -en "\\033[70G[ "
83 if [ $CHECK = 0 ]; then
84 echo -en "\\033[1;33mOK"
85 else
86 echo -en "\\033[1;31mFailed"
87 fi
88 echo -e "\\033[0;39m ]"
89 }
91 yesorno()
92 {
93 echo -n "$1"
94 case "$DEFAULT_ANSWER" in
95 Y|y) answer="y";;
96 N|n) answer="n";;
97 *) read answer;;
98 esac
99 }
101 todomsg()
102 {
103 echo -e "\\033[70G[ \\033[1;31mTODO\\033[0;39m ]"
104 }
106 # Download a file trying each mirror
107 download()
108 {
109 for i in $(cat $MIRROR); do
110 wget $i$@
111 done
112 }
114 # exec hooks provided by some packages
115 genisohooks()
116 {
117 local here=`pwd`
118 cd $ROOTFS
119 for i in $(ls etc/tazlito/*.$1 2> /dev/null); do
120 . $i $ROOTCD
121 done
122 cd $here
123 }
125 cleanup()
126 {
127 if [ -d $TMP_MNT ]; then
128 umount $TMP_MNT
129 rmdir $TMP_MNT
130 rm -f /boot
131 fi
132 }
134 # echo the package name if the tazpkg is already installed
135 installed_package_name()
136 {
137 local tazpkg
138 local package
139 local VERSION
140 tazpkg=$1
141 # try du find package name and version to be able
142 # to repack it from installation
143 # a dash (-) can exist in name *and* in version
144 package=${tazpkg%-*}
145 i=$package
146 while true; do
147 VERSION=""
148 eval $(grep -s ^VERSION= $INSTALLED/$i/receipt)
149 if [ "$i-$VERSION" = "$tazpkg" ]; then
150 echo $i
151 break
152 fi
153 case "$i" in
154 *-*);;
155 *) break;;
156 esac
157 i=${i%-*}
158 done
159 }
161 # Check if user is root.
162 check_root()
163 {
164 if test $(id -u) != 0 ; then
165 echo -e "\nYou must be root to run `basename $0` with this option."
166 echo -e "Please type 'su' and root password to become super-user.\n"
167 exit 0
168 fi
169 }
171 # Check for the rootfs tree.
172 check_rootfs()
173 {
174 if [ ! -d "$ROOTFS/etc" ] ; then
175 echo -e "\nUnable to find a distro rootfs...\n"
176 exit 0
177 fi
178 }
180 # Check for the boot dir into the root CD tree.
181 verify_rootcd()
182 {
183 if [ ! -d "$ROOTCD/boot" ] ; then
184 echo -e "\nUnable to find the rootcd boot directory...\n"
185 exit 0
186 fi
187 }
189 # Gen a new ISO image using isolinux.
190 gen_livecd_isolinux()
191 {
192 # Some packages may want to alter iso
193 genisohooks iso
194 if [ ! -f "$ROOTCD/boot/isolinux/isolinux.bin" ] ; then
195 echo -e "\nUnable to find isolinux binary.\n"
196 cleanup
197 exit 0
198 fi
199 cd $DISTRO
200 echo ""
201 echo -e "\033[1mGenerating ISO image\033[0m"
202 echo "================================================================================"
203 genisoimage -R -o $ISO_NAME.iso -b boot/isolinux/isolinux.bin \
204 -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \
205 -V "$VOLUM_NAME" -p "$PREPARED" -input-charset iso8859-1 \
206 -boot-info-table $ROOTCD
207 echo "================================================================================"
208 }
210 # Gen a new initramfs from the root file system.
211 gen_initramfs()
212 {
213 # Some packages may want to alter rootfs
214 genisohooks rootfs
215 cd $ROOTFS
216 echo ""
217 # Use lzma if installed
218 if [ -x /usr/bin/lzma -a "$COMPRESSION" != "gzip" ]; then
219 echo -n "Generating lzma'ed initramfs... "
220 find . -print | cpio -o -H newc | lzma e -si -so > $DISTRO/$INITRAMFS
221 else
222 echo -n "Generating gziped initramfs... "
223 find . -print | cpio -o -H newc | gzip -9 > $DISTRO/$INITRAMFS
224 fi
225 cd $DISTRO
226 mv $INITRAMFS $ROOTCD/boot
227 }
229 # Print ISO and rootfs size.
230 distro_stats()
231 {
232 echo ""
233 echo -e "\033[1mDistro statistics\033[0m"
234 echo "================================================================================"
235 echo "Build date : `date +%Y%m%d\ \at\ \%H:%M:%S`"
236 echo "Packages : `ls -1 $ROOTFS$INSTALLED | wc -l`"
237 echo "Rootfs size : `du -sh $ROOTFS`"
238 echo "Initramfs size : `du -sh $ROOTCD/boot/$INITRAMFS`"
239 echo "ISO image size : `du -sh $ISO_NAME.iso`"
240 echo "================================================================================"
241 echo ""
242 }
244 # Creat an empty configuration file.
245 empty_config_file()
246 {
247 cat >> tazlito.conf << "EOF"
248 # tazlito.conf: Tazlito (SliTaz Live Tool)
249 # configuration file.
250 #
252 # Name of the ISO image to generate.
253 ISO_NAME=""
255 # ISO image volum name.
256 VOLUM_NAME="SliTaz"
258 # Name of the preparator.
259 PREPARED="$USER"
261 # Path to the packages repository and the packages.list.
262 PACKAGES_REPOSITORY=""
264 # Path to the distro tree to gen-distro from a
265 # list of packages.
266 DISTRO=""
268 # Path to the directory contening additional files
269 # to copy into the rootfs and rootcd of the LiveCD.
270 ADDFILES="$DISTRO/addfiles"
272 # Default answer for binary question (Y or N)
273 DEFAULT_ANSWER="ASK"
275 # Compression utility (lzma or gzip)
276 COMPRESSION="lzma"
277 EOF
278 }
280 ####################
281 # Tazlito commands #
282 ####################
284 case "$COMMAND" in
285 stats)
286 # Tazlito general statistics from the config file.
287 #
288 echo ""
289 echo -e "\033[1mTazlito statistics\033[0m
290 ===============================================================================
291 Config file : $CONFIG_FILE
292 ISO name : $ISO_NAME.iso
293 Volum name : $VOLUM_NAME
294 Prepared : $PREPARED
295 Packages repository : $PACKAGES_REPOSITORY
296 Distro directory : $DISTRO"
297 if [ ! "$ADDFILES" = "" ] ; then
298 echo -e "Additional files : $ADDFILES"
299 fi
300 echo "================================================================================"
301 echo ""
302 ;;
303 gen-config)
304 # Gen a new config file in the current dir or the specified
305 # directory by $2.
306 #
307 if [ -n "$2" ] ; then
308 mkdir -p $2 && cd $2
309 fi
310 echo -n "Generating empty tazlito.conf..."
311 empty_config_file
312 status
313 echo ""
314 if [ -f "tazlito.conf" ] ; then
315 echo "Configuration file is ready to edit."
316 echo "File location : `pwd`/tazlito.conf"
317 echo ""
318 fi
319 ;;
320 configure)
321 # Configure a tazlito.conf config file. Start by getting
322 # a empty config file and sed it.
323 #
324 if [ -f "tazlito.conf" ] ; then
325 rm tazlito.conf
326 else
327 if test $(id -u) = 0 ; then
328 cd /etc
329 else
330 echo "You must be root to configure the main config file or in"
331 echo "the same directory of the file you want to configure."
332 exit 0
333 fi
334 fi
335 empty_config_file
336 echo""
337 echo -e "\033[1mConfiguring :\033[0m `pwd`/tazlito.conf"
338 echo "================================================================================"
339 # ISO name.
340 echo -n "ISO name : " ; read answer
341 sed -i s#'ISO_NAME=\"\"'#"ISO_NAME=\"$answer\""# tazlito.conf
342 # Volume name.
343 echo -n "Volume name : " ; read answer
344 sed -i s/'VOLUM_NAME=\"SliTaz\"'/"VOLUM_NAME=\"$answer\""/ tazlito.conf
345 # Packages repository.
346 echo -n "Packages repository : " ; read answer
347 sed -i s#'PACKAGES_REPOSITORY=\"\"'#"PACKAGES_REPOSITORY=\"$answer\""# tazlito.conf
348 # Distro path.
349 echo -n "Distro path : " ; read answer
350 sed -i s#'DISTRO=\"\"'#"DISTRO=\"$answer\""# tazlito.conf
351 echo "================================================================================"
352 echo "Config file is ready to use."
353 echo "You can now extract an ISO or generate a distro."
354 echo ""
355 ;;
356 gen-iso)
357 # Simply generated a new iso.
358 #
359 check_root
360 verify_rootcd
361 gen_livecd_isolinux
362 distro_stats
363 ;;
364 gen-initiso)
365 # Simply generated a new initramfs with a new iso.
366 #
367 check_root
368 verify_rootcd
369 gen_initramfs
370 gen_livecd_isolinux
371 distro_stats
372 ;;
373 extract-distro)
374 # Extract a ISO image to a directory and rebuild the LiveCD tree.
375 #
376 check_root
377 ISO_IMAGE=$2
378 if [ -z "$ISO_IMAGE" ] ; then
379 echo -e "\nPlease specify the path to the ISO image."
380 echo -e "Example : `basename $0` image.iso /path/target\n"
381 exit 0
382 fi
383 # Set the distro path by checking for $3 on cmdline.
384 if [ -n "$3" ] ; then
385 TARGET=$3
386 else
387 TARGET=$DISTRO
388 fi
389 # Exit if existing distro is found.
390 if [ -d "$TARGET/rootfs" ] ; then
391 echo -e "\nA rootfs exist in : $TARGET"
392 echo -e "Please clean the distro tree or change directory path.\n"
393 exit 0
394 fi
395 echo ""
396 echo -e "\033[1mTazlito extracting :\033[0m $ISO_IMAGE"
397 echo "================================================================================"
398 # Start to mount the ISO.
399 echo ""
400 echo "Mounting ISO image..."
401 mkdir -p $TMP_DIR
402 # Get ISO file size.
403 isosize=`du -sh $ISO_IMAGE`
404 mount -o loop $ISO_IMAGE $TMP_DIR
405 sleep 2
406 # Prepare target dir, copy the kernel and the rootfs.
407 mkdir -p $TARGET/rootfs
408 mkdir -p $TARGET/rootcd/boot
409 echo -n "Copying the Linux kernel..."
410 if cp $TMP_DIR/boot/vmlinuz* $TARGET/rootcd/boot 2> /dev/null; then
411 ln $TARGET/rootcd/boot/vmlinuz* $TARGET/rootcd/boot/bzImage
412 else
413 cp $TMP_DIR/boot/bzImage $TARGET/rootcd/boot
414 fi
415 status
416 echo -n "Copying isolinux files..."
417 cp -a $TMP_DIR/boot/isolinux $TARGET/rootcd/boot
418 status
419 echo -n "Copying the rootfs..."
420 cp $TMP_DIR/boot/rootfs.?z $TARGET/rootcd/boot
421 status
422 # Exract initramfs.
423 cd $TARGET/rootfs
424 echo -n "Extracting the rootfs... "
425 ( zcat ../rootcd/boot/rootfs.gz 2>/dev/null || \
426 lzma d ../rootcd/boot/rootfs.?z -so ) | cpio -id
427 # Umount and remove temp directory and cd to $TARGET to get stats.
428 umount $TMP_DIR && rm -rf $TMP_DIR
429 cd ..
430 echo ""
431 echo "================================================================================"
432 echo "Extracted : $ISO_IMAGE ($isosize)"
433 echo "Distro tree : `pwd`"
434 echo "Rootfs size : `du -sh rootfs`"
435 echo "Rootcd size : `du -sh rootcd`"
436 echo "================================================================================"
437 echo ""
438 ;;
439 gen-distro)
440 # Generate a live distro tree with a set of packages.
441 #
442 check_root
443 if [ -d $ROOTFS ] ; then
444 echo "A rootfs exist in : $DISTRO"
445 echo -e "Please clean the distro tree or change directory path.\n"
446 exit 0
447 fi
448 # Check if a package list was specified on cmdline.
449 LIST_NAME="distro-packages.list"
450 CDROM=""
451 while [ -n "$2" ]; do
452 case "$2" in
453 --iso=*)
454 CDROM="-o loop ${2#--iso=}"
455 ;;
456 --cdrom)
457 CDROM="/dev/cdrom"
458 ;;
459 *) if [ ! -f "$2" ] ; then
460 echo -e "\nUnable to find the specified packages list."
461 echo -e "List name : $2\n"
462 exit 1
463 fi
464 LIST_NAME=$2
465 ;;
466 esac
467 shift
468 done
469 if [ ! -f "$LIST_NAME" -a -d $INSTALLED ] ; then
470 # Build list with installed packages
471 for i in $(ls $INSTALLED); do
472 eval $(grep ^VERSION= $INSTALLED/$i/receipt)
473 echo "$i-$VERSION" >> $LIST_NAME
474 done
475 fi
476 # Exit if no list name.
477 if [ ! -f "$LIST_NAME" ]; then
478 echo -e "\nNo packages list found or specified. Please read the doc.\n"
479 exit 0
480 fi
481 # Start generation.
482 echo ""
483 echo -e "\033[1mTazlito generating a distro\033[0m"
484 echo "================================================================================"
485 # Misc checks
486 [ -n "$PACKAGES_REPOSITORY" ] || PACKAGES_REPOSITORY="."
487 [ -d $PACKAGES_REPOSITORY ] || mkdir -p $PACKAGES_REPOSITORY
488 # Get the list of packages using cat for a file list.
489 LIST=`cat $LIST_NAME`
490 # Verify if all packages in list are presents in $PACKAGES_REPOSITORY.
491 REPACK=""
492 DOWNLOAD=""
493 for pkg in $LIST
494 do
495 [ "$pkg" = "" ] && continue
496 pkg=${pkg%.tazpkg}
497 [ -f $PACKAGES_REPOSITORY/$pkg.tazpkg ] && continue
498 PACKAGE=$(installed_package_name $pkg)
499 [ -n "$PACKAGE" -a "$REPACK" = "y" ] && continue
500 [ -z "$PACKAGE" -a -n "$DOWNLOAD" ] && continue
501 echo -e "\nUnable to find $pkg in the repository."
502 echo -e "Path : $PACKAGES_REPOSITORY\n"
503 if [ -n "$PACKAGE" -a -z "$REPACK" ]; then
504 yesorno "Repack packages from rootfs (y/N) ? "
505 REPACK="$answer"
506 [ "$answer" = "y" ] || REPACK="n"
507 [ "$DOWNLOAD" = "y" ] && break
508 fi
509 if [ -f $MIRROR -a -z "$DOWNLOAD" ]; then
510 yesorno "Download packages from mirror (Y/n) ? "
511 DOWNLOAD="$answer"
512 if [ "$answer" = "n" ]; then
513 [ -z "$PACKAGE" ] && exit 1
514 else
515 DOWNLOAD="y"
516 [ -n "$REPACK" ] && break
517 fi
518 fi
519 [ "$REPACK" = "n" -a "$DOWNLOAD" = "n" ] && exit 1
520 done
522 # mount cdrom to be able to repack boot-loader packages
523 if [ ! -e /boot -a -n "$CDROM" ]; then
524 mkdir $TMP_MNT
525 if mount -r $CDROM $TMP_MNT 2> /dev/null; then
526 ln -s $TMP_MNT/boot /
527 if [ ! -d "$ADDFILES/rootcd" ] ; then
528 mkdir -p $ADDFILES/rootcd
529 for i in $(ls $TMP_MNT); do
530 [ "$i" = "boot" ] && continue
531 cp -a $TMP_MNT/$i $ADDFILES/rootcd
532 done
533 fi
534 else
535 rmdir $TMP_MNT
536 fi
537 fi
539 # Root fs stuff.
540 echo "Preparing the rootfs directory..."
541 mkdir -p $ROOTFS
542 sleep 2
543 for pkg in $LIST
544 do
545 [ "$pkg" = "" ] && continue
546 # First copy and extract the package in tmp dir.
547 pkg=${pkg%.tazpkg}
548 PACKAGE=$(installed_package_name $pkg)
549 mkdir -p $TMP_DIR
550 if [ ! -f $PACKAGES_REPOSITORY/$pkg.tazpkg ]; then
551 # look for package in cache
552 if [ -f $CACHE_DIR/$pkg.tazpkg ]; then
553 ln -s $CACHE_DIR/$pkg.tazpkg $PACKAGES_REPOSITORY
554 # look for package in running distribution
555 elif [ -n "$PACKAGE" -a "$REPACK" = "y" ]; then
556 tazpkg repack $PACKAGE && \
557 mv $pkg.tazpkg $PACKAGES_REPOSITORY
558 fi
559 fi
560 if [ ! -f $PACKAGES_REPOSITORY/$pkg.tazpkg ]; then
561 # get package from mirror
562 [ "$DOWNLOAD" = "y" ] && \
563 download $pkg.tazpkg && \
564 mv $pkg.tazpkg $PACKAGES_REPOSITORY
565 fi
566 if [ ! -f $PACKAGES_REPOSITORY/$pkg.tazpkg ]; then
567 echo "Missing package $pkg."
568 cleanup
569 exit 1
570 fi
571 yes "" | tazpkg install $PACKAGES_REPOSITORY/$pkg.tazpkg --root=$ROOTFS
572 done
573 cp $LIST_NAME $ROOTFS/etc/tazlito/distro-packages.list
574 echo ""
575 cd $DISTRO
576 # Copy all files from $ADDFILES/rootfs to the rootfs.
577 if [ -d "$ADDFILES/rootfs" ] ; then
578 echo -n "Copying addfiles content to the rootfs... "
579 cp -a $ADDFILES/rootfs/* $ROOTFS
580 status
581 fi
582 echo "Root file system is generated..."
583 # Root CD part.
584 echo -n "Preparing the rootcd directory..."
585 mkdir -p $ROOTCD
586 status
587 # Move the boot dir with the Linux kernel from rootfs.
588 # The boot dir goes directly on the CD.
589 if [ -d "$ROOTFS/boot" ] ; then
590 echo -n "Moving the boot directory..."
591 mv $ROOTFS/boot $ROOTCD
592 cd $ROOTCD/boot
593 ln vmlinuz-* bzImage
594 status
595 fi
596 cd $DISTRO
597 # Copy all files from $ADDFILES/rootcd to the rootcd.
598 if [ -d "$ADDFILES/rootcd" ] ; then
599 echo -n "Copying addfiles content to the rootcd... "
600 cp -a $ADDFILES/rootcd/* $ROOTCD
601 status
602 fi
603 # Initramfs and ISO image stuff.
604 gen_initramfs
605 gen_livecd_isolinux
606 distro_stats
607 cleanup
608 ;;
609 clean-distro)
610 # Remove old distro tree.
611 #
612 check_root
613 echo ""
614 echo -e "\033[1mCleaning :\033[0m $DISTRO"
615 echo "================================================================================"
616 if [ -d "$DISTRO" ] ; then
617 if [ -d "$ROOTFS" ] ; then
618 echo -n "Removing the rootfs..."
619 rm -f $DISTRO/$INITRAMFS
620 rm -rf $ROOTFS
621 status
622 fi
623 if [ -d "$ROOTCD" ] ; then
624 echo -n "Removing the rootcd..."
625 rm -rf $ROOTCD
626 status
627 fi
628 echo -n "Removing eventual ISO image..."
629 rm -f $DISTRO/$ISO_NAME.iso
630 status
631 fi
632 echo "================================================================================"
633 echo ""
634 ;;
635 addhacker)
636 # Without /etc/passwd...
637 #
638 check_root
639 echo ""
640 echo -e "\033[1mAdduser hacker to :\033[0m $ROOTFS"
641 echo "================================================================================"
642 if [ ! -d "$ROOTFS/etc" ] ; then
643 echo -e "\nUnable to find : $ROOTFS/etc"
644 echo -e "Users and passwords config files will not be found.\n"
645 exit 0
646 fi
647 # Go for echoing on configuration files if any hacker was found.
648 #
649 if [ ! "`cat $ROOTFS/etc/passwd | grep hacker`" ] ; then
650 echo -n "Configuring $ROOTFS/etc..."
651 echo 'hacker:x:500:500:Linux User,,,:/home/hacker:/bin/ash' >> $ROOTFS/etc/passwd
652 echo 'hacker::13646:0:99999:7:::' >> $ROOTFS/etc/shadow
653 echo 'hacker:x:500:' >> $ROOTFS/etc/group
654 echo 'hacker:!::' >> $ROOTFS/etc/gshadow
655 status
656 else
657 echo "Hacker is already in : $ROOTFS/etc/passwd"
658 fi
659 # Hacker can listen to music
660 #
661 if grep -q audio $ROOTFS/etc/group; then
662 sed -i s/'audio:x:20:'/'audio:x:20:hacker'/ $ROOTFS/etc/group
663 fi
664 # /home/hacker files.
665 #
666 echo -n "Creating default directories... "
667 mkdir -p $ROOTFS/home/hacker/Documents \
668 $ROOTFS/home/hacker/Downloads \
669 $ROOTFS/home/hacker/Images \
670 $ROOTFS/home/hacker/Public \
671 $ROOTFS/home/hacker/Templates
672 status
673 # Change permissions.
674 #
675 echo -n "Chmodig all files in /home/hacker..."
676 chown -R 500.500 $ROOTFS/home/hacker
677 status
678 echo "================================================================================"
679 echo "Linux User Hacker have an account in the distro."
680 echo ""
681 ;;
682 check-distro)
683 # Check for a few LiveCD needed files not installed by packages.
684 #
685 check_rootfs
686 echo ""
687 echo -e "\033[1mChecking distro :\033[0m $ROOTFS"
688 echo "================================================================================"
689 # SliTaz release info.
690 if [ ! -f "$ROOTFS/etc/slitaz-release" ]; then
691 echo "Missing release info : /etc/slitaz-release"
692 else
693 release=`cat $ROOTFS/etc/slitaz-release`
694 echo -n "Release : $release"
695 status
696 fi
697 # Tazpkg mirror.
698 if [ ! -f "$ROOTFS/var/lib/tazpkg/mirror" ]; then
699 echo -n "Mirror URL : Missing /var/lib/tazpkg/mirror"
700 todomsg
701 else
702 echo -n "Mirror configuration exist..."
703 status
704 fi
705 # Isolinux msg
706 if grep -q "cooking-XXXXXXXX" /$ROOTCD/boot/isolinux/isolinux.msg; then
707 echo -n "Isolinux msg : Missing cooking date XXXXXXXX (ex `date +%Y%m%d`)"
708 todomsg
709 else
710 echo -n "Isolinux message seems good..."
711 status
712 fi
713 echo "================================================================================"
714 echo ""
715 ;;
716 burn-iso)
717 # Guess cdrom device, ask user and burn the ISO.
718 #
719 check_root
720 DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3`
721 DRIVE_SPEED=`cat /proc/sys/dev/cdrom/info | grep "drive speed" | cut -f 3`
722 # We can specify an alternative ISO from the cmdline.
723 if [ -n "$2" ] ; then
724 iso=$2
725 else
726 iso=$DISTRO/$ISO_NAME.iso
727 fi
728 if [ ! -f "$iso" ]; then
729 echo -e "\nUnable to find ISO : $iso\n"
730 exit 0
731 fi
732 echo ""
733 echo -e "\033[1mTazlito burn ISO\033[0m "
734 echo "================================================================================"
735 echo "Cdrom device : /dev/$DRIVE_NAME"
736 echo "Drive speed : $DRIVE_SPEED"
737 echo "ISO image : $iso"
738 echo "================================================================================"
739 echo ""
740 yesorno "Burn ISO image (y/N) ? "
741 if [ "$answer" == "y" ]; then
742 echo ""
743 echo "Starting Wodim to burn the iso..." && sleep 2
744 echo "================================================================================"
745 wodim speed=$DRIVE_SPEED dev=/dev/$DRIVE_NAME $DISTRO/$ISO_NAME.iso
746 echo "================================================================================"
747 echo "ISO image is burned to cdrom."
748 else
749 echo -e "\nExiting. No ISO burned."
750 fi
751 echo ""
752 ;;
753 usage|*)
754 # Clear and print usage also for all unknow commands.
755 #
756 clear
757 usage
758 ;;
760 esac
762 exit 0