tazlito rev 1
Add tazlito 1.1 from slitaz-tools-1.3
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Dec 01 11:54:15 2007 +0100 (2007-12-01) |
parents | 04426d9639b1 |
children | d67f174debfd |
files | tazlito |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tazlito Sat Dec 01 11:54:15 2007 +0100 1.3 @@ -0,0 +1,599 @@ 1.4 +#!/bin/sh 1.5 +# TazLito - SliTaz Live Tool. 1.6 +# 1.7 +# Tazlito is a tool to help generating and configuring SliTaz LiveCD 1.8 +# ISO images. You can creat a custom distro in one command from a list of 1.9 +# packages, extract a existing ISO image to hack it, creat new initramfs 1.10 +# and/or new ISO. Most commands must be run by root, expect the stats 1.11 +# and the configuration file manipulation. 1.12 +# 1.13 +# (C) 2007 SliTaz - GNU General Public License. 1.14 +# Author : <pankso@slitaz.org> 1.15 +# 1.16 +VERSION=1.1 1.17 + 1.18 +# Tazlito configuration variables to be shorter 1.19 +# and to use words rater than numbers. 1.20 +COMMAND=$1 1.21 +LIST_NAME=$2 1.22 +TMP_DIR=/tmp/tazlito-$$-$RANDOM 1.23 +TOP_DIR=`pwd` 1.24 +INITRAMFS=rootfs.gz 1.25 + 1.26 +# Try to include config file, continue if command is gen-config or exit. 1.27 +# The main config is in /etc used by default. 1.28 +if [ -f "/etc/slitaz-tools/tazlito.conf" ] ; then 1.29 + CONFIG_FILE="/etc/slitaz-tools/tazlito.conf" 1.30 +fi 1.31 +# Specific distro config file can be put in a distro tree. 1.32 +if [ -f "$TOP_DIR/tazlito.conf" ] ; then 1.33 + CONFIG_FILE="$TOP_DIR/tazlito.conf" 1.34 +fi 1.35 +if [ ! "$CONFIG_FILE" = "" ] ; then 1.36 + . $CONFIG_FILE 1.37 +else 1.38 + if [ "$COMMAND" = "gen-config" ] ; then 1.39 + continue 1.40 + else 1.41 + echo "Unable to find any configuration file. Please read the doc" 1.42 + echo "or run '`basename $0` gen-config' to get an empty config file." 1.43 + exit 0 1.44 + fi 1.45 +fi 1.46 + 1.47 +# Set the rootfs and rootcd path with $DISTRO 1.48 +# configuration variable. 1.49 +ROOTFS=$DISTRO/rootfs 1.50 +ROOTCD=$DISTRO/rootcd 1.51 + 1.52 +##################### 1.53 +# Tazlito functions # 1.54 +##################### 1.55 + 1.56 +# Print the usage. 1.57 +usage () 1.58 +{ 1.59 + echo -e "\nSliTaz Live Tool - Version: $VERSION\n 1.60 +\033[1mUsage: \033[0m `basename $0` [command] [list|iso] [dir] 1.61 +\033[1mCommands: \033[0m\n 1.62 + usage Print this short usage. 1.63 + stats View Tazlito and distro configuration statistics. 1.64 + gen-config Generate a new configuration file for a distro. 1.65 + configure Configure the main config file or a specific tazlito.conf. 1.66 + gen-iso Generate a new ISO from a distro tree. 1.67 + gen-initiso Generate a new initramfs and ISO from the distro tree. 1.68 + extract-distro Extract and ISO to a directory and rebuild LiveCD tree. 1.69 + gen-distro Generated a Live distro and ISO from a list of packages. 1.70 + clean-distro Remove all files generated by gen-distro. 1.71 + addhacker Add Linux User Hacker to the current distro. 1.72 + check-distro Help to check if distro is ready to release. 1.73 + burn-iso Burn ISO image to a cdrom using Wodim.\n" 1.74 +} 1.75 + 1.76 +# Status function. 1.77 +status() 1.78 +{ 1.79 + local CHECK=$? 1.80 + echo -en "\\033[70G[ " 1.81 + if [ $CHECK = 0 ]; then 1.82 + echo -en "\\033[1;33mOK" 1.83 + else 1.84 + echo -en "\\033[1;31mFailed" 1.85 + fi 1.86 + echo -e "\\033[0;39m ]" 1.87 +} 1.88 +todomsg() 1.89 +{ 1.90 + echo -e "\\033[70G[ \\033[1;31mTODO\\033[0;39m ]" 1.91 +} 1.92 + 1.93 +# Check if user is root. 1.94 +check_root() 1.95 +{ 1.96 + if test $(id -u) != 0 ; then 1.97 + echo -e "\nYou must be root to run `basename $0` with this option." 1.98 + echo -e "Please type 'su' and root password to become super-user.\n" 1.99 + exit 0 1.100 + fi 1.101 +} 1.102 + 1.103 +# Check for the boot dir into the root CD tree. 1.104 +verify_rootcd() 1.105 +{ 1.106 + if [ ! -d "$ROOTCD/boot" ] ; then 1.107 + echo -e "\nUnable to find the rootcd boot directory...\n" 1.108 + exit 0 1.109 + fi 1.110 +} 1.111 + 1.112 +# Gen a new ISO image using isolinux. 1.113 +gen_livecd_isolinux() 1.114 +{ 1.115 + if [ ! -f "$ROOTCD/boot/isolinux/isolinux.bin" ] ; then 1.116 + echo -e "\nUnable to find isolinux binary.\n" 1.117 + exit 0 1.118 + fi 1.119 + cd $DISTRO 1.120 + echo "" 1.121 + echo -e "\033[1mGenerating ISO image\033[0m" 1.122 + echo "================================================================================" 1.123 + genisoimage -R -o $ISO_NAME.iso -b boot/isolinux/isolinux.bin \ 1.124 + -c boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 \ 1.125 + -V "$VOLUM_NAME" -p "$PREPARED" -input-charset iso8859-1 \ 1.126 + -boot-info-table $ROOTCD 1.127 + echo "================================================================================" 1.128 +} 1.129 + 1.130 +# Gen a new initramfs from the root file system. 1.131 +gen_initramfs() 1.132 +{ 1.133 + cd $ROOTFS 1.134 + echo "" 1.135 + echo -n "Generating initramfs... " 1.136 + find . -print | cpio -o -H newc | gzip -9 > $DISTRO/$INITRAMFS 1.137 + cd $DISTRO 1.138 + cp $INITRAMFS $ROOTCD/boot 1.139 +} 1.140 + 1.141 +# Print ISO and rootfs size. 1.142 +distro_stats() 1.143 +{ 1.144 + echo "" 1.145 + echo -e "\033[1mDistro statistics\033[0m" 1.146 + echo "================================================================================" 1.147 + echo "Build date : `date +%Y%m%d\ \at\ \%H:%M:%S`" 1.148 + echo "Packages : `ls -1 $ROOTFS/var/lib/tazpkg/installed | wc -l`" 1.149 + echo "Rootfs size : `du -sh $ROOTFS`" 1.150 + echo "Initramfs size : `du -sh $INITRAMFS`" 1.151 + echo "ISO image size : `du -sh $ISO_NAME.iso`" 1.152 + echo "================================================================================" 1.153 + echo "" 1.154 +} 1.155 + 1.156 +# Creat an empty configuration file. 1.157 +empty_config_file() 1.158 +{ 1.159 + cat >> tazlito.conf << "EOF" 1.160 +# tazlito.conf: Tazlito (SliTaz Live Tool) 1.161 +# configuration file. 1.162 +# 1.163 + 1.164 +# Name of the ISO image to generate. 1.165 +ISO_NAME="" 1.166 + 1.167 +# ISO image volum name. 1.168 +VOLUM_NAME="SliTaz" 1.169 + 1.170 +# Name of the preparator. 1.171 +PREPARED="$USER" 1.172 + 1.173 +# Path to the packages repository and the packages.list. 1.174 +PACKAGES_REPOSITORY="" 1.175 + 1.176 +# Path to the distro tree to gen-distro from a 1.177 +# list of packages. 1.178 +DISTRO="" 1.179 + 1.180 +# Path to the directory contening additional files 1.181 +# to copy into the rootfs and rootcd of the LiveCD. 1.182 +ADDFILES="$DISTRO/addfiles" 1.183 +EOF 1.184 +} 1.185 + 1.186 +#################### 1.187 +# Tazlito commands # 1.188 +#################### 1.189 + 1.190 +case "$COMMAND" in 1.191 + stats) 1.192 + # Tazlito general statistics from the config file. 1.193 + # 1.194 + echo "" 1.195 + echo -e "\033[1mTazlito statistics\033[0m 1.196 +=============================================================================== 1.197 +Config file : $CONFIG_FILE 1.198 +ISO name : $ISO_NAME.iso 1.199 +Volum name : $VOLUM_NAME 1.200 +Prepared : $PREPARED 1.201 +Packages repository : $PACKAGES_REPOSITORY 1.202 +Distro directory : $DISTRO" 1.203 + if [ ! "$ADDFILES" = "" ] ; then 1.204 + echo -e "Additional files : $ADDFILES" 1.205 + fi 1.206 + echo "================================================================================" 1.207 + echo "" 1.208 + ;; 1.209 + gen-config) 1.210 + # Gen a new config file in the current dir or the specified 1.211 + # directory by $2. 1.212 + # 1.213 + if [ -n "$2" ] ; then 1.214 + mkdir -p $2 && cd $2 1.215 + fi 1.216 + echo -n "Generating empty tazlito.conf..." 1.217 + empty_config_file 1.218 + status 1.219 + echo "" 1.220 + if [ -f "tazlito.conf" ] ; then 1.221 + echo "Configuration file is ready to edit." 1.222 + echo "File location : `pwd`/tazlito.conf" 1.223 + echo "" 1.224 + fi 1.225 + ;; 1.226 + configure) 1.227 + # Configure a tazlito.conf config file. Start by getting 1.228 + # a empty config file and sed it. 1.229 + # 1.230 + if [ -f "tazlito.conf" ] ; then 1.231 + continue 1.232 + rm tazlito.conf 1.233 + else 1.234 + if test $(id -u) = 0 ; then 1.235 + cd /etc 1.236 + else 1.237 + echo "You must be root to configure the main config file or in" 1.238 + echo "the same directory of the file you want to configure." 1.239 + exit 0 1.240 + fi 1.241 + fi 1.242 + empty_config_file 1.243 + echo"" 1.244 + echo -e "\033[1mConfiguring :\033[0m `pwd`/tazlito.conf" 1.245 + echo "================================================================================" 1.246 + # ISO name. 1.247 + echo -n "ISO name : " ; read anser 1.248 + sed -i s#'ISO_NAME=\"\"'#"ISO_NAME=\"$anser\""# tazlito.conf 1.249 + # Volum name. 1.250 + echo -n "Volum name : " ; read anser 1.251 + sed -i s/'VOLUM_NAME=\"SliTaz\"'/"VOLUM_NAME=\"$anser\""/ tazlito.conf 1.252 + # Packages repository. 1.253 + echo -n "Packages repository : " ; read anser 1.254 + sed -i s#'PACKAGES_REPOSITORY=\"\"'#"PACKAGES_REPOSITORY=\"$anser\""# tazlito.conf 1.255 + # Distro path. 1.256 + echo -n "Distro path : " ; read anser 1.257 + sed -i s#'DISTRO=\"\"'#"DISTRO=\"$anser\""# tazlito.conf 1.258 + echo "================================================================================" 1.259 + echo "Config file is ready to use." 1.260 + echo "You can now extract an ISO or generate a distro." 1.261 + echo "" 1.262 + ;; 1.263 + gen-iso) 1.264 + # Simply generated a new iso. 1.265 + # 1.266 + check_root 1.267 + verify_rootcd 1.268 + gen_livecd_isolinux 1.269 + distro_stats 1.270 + ;; 1.271 + gen-initiso) 1.272 + # Simply generated a new initramfs with a new iso. 1.273 + # 1.274 + check_root 1.275 + verify_rootcd 1.276 + gen_initramfs 1.277 + gen_livecd_isolinux 1.278 + distro_stats 1.279 + ;; 1.280 + extract-distro) 1.281 + # Extract a ISO image to a directory and rebuild the LiveCD tree. 1.282 + # 1.283 + check_root 1.284 + ISO_IMAGE=$2 1.285 + if [ -z "$ISO_IMAGE" ] ; then 1.286 + echo -e "\nPlease specify the path to the ISO image." 1.287 + echo -e "Example : `basename $0` image.iso /path/target\n" 1.288 + exit 0 1.289 + fi 1.290 + # Set the distro path by checking for $3 on cmdline. 1.291 + if [ -n "$3" ] ; then 1.292 + TARGET=$3 1.293 + else 1.294 + TARGET=$DISTRO 1.295 + fi 1.296 + # Exit if existing distro is found. 1.297 + if [ -d "$TARGET/rootfs" ] ; then 1.298 + echo -e "\nA rootfs exist in : $TARGET" 1.299 + echo -e "Please clean the distro tree or change directory path.\n" 1.300 + exit 0 1.301 + fi 1.302 + echo "" 1.303 + echo -e "\033[1mTazlito extracting :\033[0m $ISO_IMAGE" 1.304 + echo "================================================================================" 1.305 + # Start to mount the ISO. 1.306 + echo "" 1.307 + echo "Mounting ISO image..." 1.308 + mkdir -p $TMP_DIR 1.309 + # Get ISO file size. 1.310 + isosize=`du -sh $ISO_IMAGE` 1.311 + mount -o loop $ISO_IMAGE $TMP_DIR 1.312 + sleep 2 1.313 + # Prepare target dir, copy the kernel and the rootfs. 1.314 + mkdir -p $TARGET/rootfs 1.315 + mkdir -p $TARGET/rootcd/boot 1.316 + echo -n "Copying the Linux kernel..." 1.317 + cp $TMP_DIR/boot/bzImage $TARGET/rootcd/boot 1.318 + status 1.319 + echo -n "Copying isolinux files..." 1.320 + cp -a $TMP_DIR/boot/isolinux $TARGET/rootcd/boot 1.321 + status 1.322 + echo -n "Copying the rootfs..." 1.323 + cp $TMP_DIR/boot/rootfs.gz $TARGET/rootcd/boot 1.324 + cp $TMP_DIR/boot/rootfs.gz $TARGET/rootfs 1.325 + status 1.326 + # Exract initramfs. 1.327 + cd $TARGET/rootfs 1.328 + echo -n "Extracting the rootfs... " 1.329 + gzip -d rootfs.gz && cpio -id < rootfs 1.330 + rm rootfs 1.331 + # Umount and remove temp directory and cd to $TARGET to get stats. 1.332 + umount $TMP_DIR && rm -rf $TMP_DIR 1.333 + cd .. 1.334 + echo "" 1.335 + echo "================================================================================" 1.336 + echo "Extracted : $ISO_IMAGE ($isosize)" 1.337 + echo "Distro tree : `pwd`" 1.338 + echo "Rootfs size : `du -sh rootfs`" 1.339 + echo "Rootcd size : `du -sh rootcd`" 1.340 + echo "================================================================================" 1.341 + echo "" 1.342 + ;; 1.343 + gen-distro) 1.344 + # Generate a live distro tree with a set of packages. 1.345 + # 1.346 + check_root 1.347 + if [ -d $ROOTFS ] ; then 1.348 + echo "A rootfs exist in : $DISTRO" 1.349 + echo -e "Please clean the distro tree or change directory path.\n" 1.350 + exit 0 1.351 + fi 1.352 + # First check for the main packages list then 1.353 + # for a distro-packages.list in the current directory 1.354 + # if none, check if a package list was specified on cmdline. 1.355 + if [ -f "/etc/slitaz-tools/distro-packages.list" ] ; then 1.356 + LIST_NAME="distro-packages.list" 1.357 + fi 1.358 + if [ -f "distro-packages.list" ] ; then 1.359 + LIST_NAME="distro-packages.list" 1.360 + fi 1.361 + if [ -n "$2" ] ; then 1.362 + if [ ! -f "$2" ] ; then 1.363 + echo -e "\nUnable to find the specified packages list." 1.364 + echo -e "List name : $2\n" 1.365 + exit 0 1.366 + else 1.367 + LIST_NAME=$2 1.368 + fi 1.369 + fi 1.370 + # Exit if no list name. 1.371 + if [ "$LIST_NAME" = "" ] ; then 1.372 + echo -e "\nNo packages list found or specified. Please read the doc.\n" 1.373 + exit 0 1.374 + fi 1.375 + # Start generation. 1.376 + echo "" 1.377 + echo -e "\033[1mTazlito generating a distro\033[0m" 1.378 + echo "================================================================================" 1.379 + # Get the list of packages using cat for a file list. 1.380 + LIST=`cat $LIST_NAME` 1.381 + # Verify if all packages in list are presents in $PACKAGES_REPOSITORY. 1.382 + for pkg in $LIST 1.383 + do 1.384 + pkg=${pkg%.tazpkg} 1.385 + if [ ! -f $PACKAGES_REPOSITORY/$pkg.tazpkg ] ; then 1.386 + echo -e "\nUnable to find $pkg in the repository." 1.387 + echo -e "Path : $PACKAGES_REPOSITORY\n" 1.388 + exit 0 1.389 + fi 1.390 + done 1.391 + # Root fs stuff. 1.392 + echo "Preparing the rootfs directory..." 1.393 + mkdir -p $ROOTFS 1.394 + sleep 2 1.395 + for pkg in $LIST 1.396 + do 1.397 + # First copy and extract the package in tmp dir. 1.398 + pkg=${pkg%.tazpkg} 1.399 + mkdir -p $TMP_DIR 1.400 + cp $PACKAGES_REPOSITORY/$pkg.tazpkg $TMP_DIR && cd $TMP_DIR 1.401 + echo "" 1.402 + echo -n "Installing $PACKAGE... " 1.403 + cpio -id < $pkg.tazpkg && rm -f $pkg.tazpkg 1.404 + gzip -d fs.cpio.gz 1.405 + echo -n "Extracting the file system... " 1.406 + cpio -id < fs.cpio && rm fs.cpio 1.407 + # Copy all packages fs and receipt to the rootfs. 1.408 + echo -n "Copying files to the rootfs..." 1.409 + cp -a fs/* $ROOTFS 1.410 + . $PWD/receipt 1.411 + mkdir -p $ROOTFS/var/lib/tazpkg/installed/$PACKAGE 1.412 + # Copy the receipt, list of files and description if exist. 1.413 + cp receipt $ROOTFS/var/lib/tazpkg/installed/$PACKAGE 1.414 + cp files.list $ROOTFS/var/lib/tazpkg/installed/$PACKAGE 1.415 + if [ -f "description.txt" ] ; then 1.416 + cp description.txt $ROOTFS/var/lib/tazpkg/installed/$PACKAGE 1.417 + fi 1.418 + status 1.419 + # Remove tmp dir to get a empty one for the next package. 1.420 + rm -rf $TMP_DIR 1.421 + done 1.422 + echo "" 1.423 + cd $DISTRO 1.424 + # Copy all files from $ADDFILES/rootfs to the rootfs. 1.425 + if [ -d "$ADDFILES/rootfs" ] ; then 1.426 + echo -n "Copying addfiles content to the rootfs... " 1.427 + cp -a $ADDFILES/rootfs/* $ROOTFS && status 1.428 + fi 1.429 + echo "Root file system is generated..." 1.430 + # Root CD part. 1.431 + echo -n "Preparing the rootcd directory..." 1.432 + mkdir -p $ROOTCD 1.433 + status 1.434 + # Move the boot dir with the Linux kernel from rootfs. 1.435 + # The boot dir goes directly on the CD. 1.436 + if [ -d "$ROOTFS/boot" ] ; then 1.437 + echo -n "Moving the boot directory..." 1.438 + mv $ROOTFS/boot $ROOTCD 1.439 + cd $ROOTCD/boot 1.440 + mv vmlinuz-* bzImage 1.441 + status 1.442 + fi 1.443 + cd $DISTRO 1.444 + # Copy all files from $ADDFILES/rootcd to the rootcd. 1.445 + if [ -d "$ADDFILES/rootcd" ] ; then 1.446 + echo -n "Copying addfiles content to the rootcd... " 1.447 + cp -a $ADDFILES/rootcd/* $ROOTCD && status 1.448 + fi 1.449 + # Initramfs and ISO image stuff. 1.450 + gen_initramfs 1.451 + gen_livecd_isolinux 1.452 + distro_stats 1.453 + ;; 1.454 + clean-distro) 1.455 + # Remove old distro tree. 1.456 + # 1.457 + check_root 1.458 + echo "" 1.459 + echo -e "\033[1mCleaning :\033[0m $DISTRO" 1.460 + echo "================================================================================" 1.461 + if [ -d "$DISTRO" ] ; then 1.462 + if [ -d "$ROOTFS" ] ; then 1.463 + echo -n "Removing the rootfs..." 1.464 + rm -f $DISTRO/$INITRAMFS 1.465 + rm -rf $ROOTFS && status 1.466 + fi 1.467 + if [ -d "$ROOTCD" ] ; then 1.468 + echo -n "Removing the rootcd..." 1.469 + rm -rf $ROOTCD && status 1.470 + fi 1.471 + echo -n "Removing eventual ISO image..." 1.472 + rm -f $DISTRO/$ISO_NAME.iso && status 1.473 + fi 1.474 + echo "================================================================================" 1.475 + echo "" 1.476 + ;; 1.477 + addhacker) 1.478 + # Without /etc/passwd... 1.479 + # 1.480 + check_root 1.481 + echo "" 1.482 + echo -e "\033[1mAdduser hacker to :\033[0m $ROOTFS" 1.483 + echo "================================================================================" 1.484 + if [ ! -d "$ROOTFS/etc" ] ; then 1.485 + echo -e "\nUnable to find : $ROOTFS/etc" 1.486 + echo -e "Users and passwords config files will not be found.\n" 1.487 + exit 0 1.488 + fi 1.489 + # Go for echoing on configuration files if any hacker was found. 1.490 + # 1.491 + if [ ! "`cat $ROOTFS/etc/passwd | grep hacker`" ] ; then 1.492 + echo -n "Configuring $ROOTFS/etc..." 1.493 + echo 'hacker:x:500:500:Linux User,,,:/home/hacker:/bin/ash' >> $ROOTFS/etc/passwd 1.494 + echo 'hacker::13646:0:99999:7:::' >> $ROOTFS/etc/shadow 1.495 + echo 'hacker:x:500:' >> $ROOTFS/etc/group 1.496 + echo 'hacker:!::' >> $ROOTFS/etc/gshadow 1.497 + status 1.498 + else 1.499 + echo "Hacker is already in : $ROOTFS/etc/passwd" 1.500 + fi 1.501 + # /home/hacker files. 1.502 + # 1.503 + echo -n "Creating default directories... " 1.504 + mkdir -p $ROOTFS/home/hacker/Documents \ 1.505 + $ROOTFS/home/hacker/Downloads \ 1.506 + $ROOTFS/home/hacker/Images \ 1.507 + $ROOTFS/home/hacker/Public \ 1.508 + $ROOTFS/home/hacker/Templates 1.509 + status 1.510 + # Change permissions. 1.511 + # 1.512 + echo -n "Chmodig all files in /home/hacker..." 1.513 + chown -R 500.500 $ROOTFS/home/hacker 1.514 + status 1.515 + echo "================================================================================" 1.516 + echo "Linux User Hacker have an account in the distro." 1.517 + echo "" 1.518 + ;; 1.519 + check-distro) 1.520 + # Check for a few LiveCD needed files not installed by packages. 1.521 + # 1.522 + if [ ! -d "$ROOTFS" ] ; then 1.523 + echo -e "\nUnable to find a distro rootfs to check.\n" 1.524 + exit 0 1.525 + fi 1.526 + echo "" 1.527 + echo -e "\033[1mChecking distro :\033[0m $ROOTFS" 1.528 + echo "================================================================================" 1.529 + # SliTaz release info. 1.530 + if [ ! -f "$ROOTFS/etc/slitaz-release" ]; then 1.531 + echo "Missing release info : /var/lib/tazpkg/mirror" 1.532 + else 1.533 + release=`cat $ROOTFS/etc/slitaz-release` 1.534 + echo -n "Release : $release" 1.535 + status 1.536 + fi 1.537 + # Tazpkg mirror. 1.538 + if [ ! -f "$ROOTFS/var/lib/tazpkg/mirror" ]; then 1.539 + echo -n "Mirror URL : Missing /var/lib/tazpkg/mirror" 1.540 + todomsg 1.541 + else 1.542 + echo -n "Mirror configuration exist..." 1.543 + status 1.544 + fi 1.545 + # Isolinux msg 1.546 + if grep -q "cooking-XXXXXXXX" /$ROOTCD/boot/isolinux/isolinux.msg; then 1.547 + echo -n "Isolinux msg : Missing cooking date XXXXXXXX (ex `date +%Y%m%d`)" 1.548 + todomsg 1.549 + else 1.550 + echo -n "Isolinux message seems good..." 1.551 + status 1.552 + fi 1.553 + echo "================================================================================" 1.554 + echo "" 1.555 + ;; 1.556 + burn-iso) 1.557 + # Guess cdrom device, ask user and burn the ISO. 1.558 + # 1.559 + check_root 1.560 + DRIVE_NAME=`cat /proc/sys/dev/cdrom/info | grep "drive name" | cut -f 3` 1.561 + DRIVE_SPEED=`cat /proc/sys/dev/cdrom/info | grep "drive speed" | cut -f 3` 1.562 + # We can specify an alternative ISO from the cmdline. 1.563 + if [ -n "$2" ] ; then 1.564 + iso=$2 1.565 + else 1.566 + iso=$DISTRO/$ISO_NAME.iso 1.567 + fi 1.568 + if [ ! -f "$iso" ]; then 1.569 + echo -e "\nUnable to find ISO : $iso\n" 1.570 + exit 0 1.571 + fi 1.572 + echo "" 1.573 + echo -e "\033[1mTazlito burn ISO\033[0m " 1.574 + echo "================================================================================" 1.575 + echo "Cdrom device : /dev/$DRIVE_NAME" 1.576 + echo "Drive speed : $DRIVE_SPEED" 1.577 + echo "ISO image : $iso" 1.578 + echo "================================================================================" 1.579 + echo "" 1.580 + echo -n "Burn ISO image (y/N) ? "; read anser 1.581 + if [ "$anser" == "y" ]; then 1.582 + echo "" 1.583 + echo "Starting Wodim to burn the iso..." && sleep 2 1.584 + echo "================================================================================" 1.585 + wodim speed=$DRIVE_SPEED dev=/dev/$DRIVE_NAME $DISTRO/$ISO_NAME.iso 1.586 + echo "================================================================================" 1.587 + echo "ISO image is burned to cdrom." 1.588 + else 1.589 + echo -e "\nExiting. No ISO burned." 1.590 + fi 1.591 + echo "" 1.592 + ;; 1.593 + usage|*) 1.594 + # Clear and print usage also for all unknow commands. 1.595 + # 1.596 + clear 1.597 + usage 1.598 + ;; 1.599 + 1.600 +esac 1.601 + 1.602 +exit 0