tazlito rev 99
Add --force option to gen-distro command. Force removal of existing rootfs
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Mon May 25 23:13:36 2009 +0200 (2009-05-25) |
parents | 72ea006a4873 |
children | 9b31f28a4eb0 |
files | tazlito |
line diff
1.1 --- a/tazlito Thu Apr 16 02:07:00 2009 +0200 1.2 +++ b/tazlito Mon May 25 23:13:36 2009 +0200 1.3 @@ -738,11 +738,7 @@ 1.4 # Generate a live distro tree with a set of packages. 1.5 # 1.6 check_root 1.7 - if [ -d $ROOTFS ] ; then 1.8 - echo -e "\nA rootfs exists in : $DISTRO" 1.9 - echo -e "Please clean the distro tree or change directory path.\n" 1.10 - exit 0 1.11 - fi 1.12 + 1.13 # Check if a package list was specified on cmdline. 1.14 LIST_NAME="distro-packages.list" 1.15 CDROM="" 1.16 @@ -754,6 +750,9 @@ 1.17 --cdrom) 1.18 CDROM="/dev/cdrom" 1.19 ;; 1.20 + --force) 1.21 + DELETE_ROOTFS="true" 1.22 + ;; 1.23 *) if [ ! -f "$2" ] ; then 1.24 echo -e "\nUnable to find the specified packages list." 1.25 echo -e "List name : $2\n" 1.26 @@ -764,6 +763,18 @@ 1.27 esac 1.28 shift 1.29 done 1.30 + 1.31 + if [ -d $ROOTFS ] ; then 1.32 + # Delete $ROOTFS if --force is set on command line 1.33 + if [ ! -z $DELETE_ROOTFS ]; then 1.34 + rm -rf $ROOTFS 1.35 + unset $DELETE_ROOTFS 1.36 + else 1.37 + echo -e "\nA rootfs exists in : $DISTRO" 1.38 + echo -e "Please clean the distro tree or change directory path.\n" 1.39 + exit 0 1.40 + fi 1.41 + fi 1.42 if [ ! -f "$LIST_NAME" -a -d $INSTALLED ] ; then 1.43 # Build list with installed packages 1.44 for i in $(ls $INSTALLED); do