tazlito view tazlito @ rev 14

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