OSDN Git Service

[update] : Added --normwork
authorhayao <hayao@fascode.net>
Thu, 11 Mar 2021 09:54:32 +0000 (18:54 +0900)
committerhayao <hayao@fascode.net>
Thu, 11 Mar 2021 09:54:32 +0000 (18:54 +0900)
build.sh
default.conf

index f87bd86..af2de24 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -187,6 +187,7 @@ _usage () {
     echo "         --noloopmod             No check and load kernel module automatically"
     echo "         --nodepend              No check package dependencies before building"
     echo "         --noiso                 No build iso image (Use with --tarball)"
+    echo "         --normwork              No remove working dir"
     echo "         --shmkalteriso          Use the shell script version of mkalteriso"
     echo
     echo " Many packages are installed from AUR, so specifying --noaur can cause problems."
@@ -383,7 +384,7 @@ prepare_env() {
     [[ ! -d "${work_dir}" ]] && mkdir -p "${work_dir}"
 
     # Check work dir
-    if [[ -n $(ls -a "${work_dir}" 2> /dev/null | grep -xv ".." | grep -xv ".") ]]; then
+    if [[ -n $(ls -a "${work_dir}" 2> /dev/null | grep -xv ".." | grep -xv ".") ]] && [[ "${normwork}" = false ]]; then
         umount_chroot_advance
         msg_info "Deleting the contents of ${work_dir}..."
         remove "${work_dir%/}"/*
@@ -393,8 +394,10 @@ prepare_env() {
     local _trap_remove_work
     _trap_remove_work() {
         local status=${?}
-        echo
-        "${tools_dir}/clean.sh" -o -w $(realpath "${work_dir}") $([[ "${debug}" = true ]] && echo -n "-d")
+        if [[ "${normwork}" = false ]]; then
+            echo
+            "${tools_dir}/clean.sh" -o -w $(realpath "${work_dir}") $([[ "${debug}" = true ]] && echo -n "-d")
+        fi
         exit ${status}
     }
     trap '_trap_remove_work' 1 2 3 15
@@ -1038,7 +1041,7 @@ make_iso() {
 # Parse options
 ARGUMENT="${@}"
 OPTS="a:bc:deg:hjk:l:o:p:rt:u:w:x"
-OPTL="arch:,boot-splash,comp-type:,debug,cleaning,cleanup,gpgkey:,help,lang:,japanese,kernel:,out:,password:,comp-opts:,user:,work:,bash-debug,nocolor,noconfirm,nodepend,gitversion,shmkalteriso,msgdebug,noloopmod,tarball,noiso,noaur,nochkver,channellist,config:,noefi,nodebug,nosigcheck"
+OPTL="arch:,boot-splash,comp-type:,debug,cleaning,cleanup,gpgkey:,help,lang:,japanese,kernel:,out:,password:,comp-opts:,user:,work:,bash-debug,nocolor,noconfirm,nodepend,gitversion,shmkalteriso,msgdebug,noloopmod,tarball,noiso,noaur,nochkver,channellist,config:,noefi,nodebug,nosigcheck,normwork"
 if ! OPT=$(getopt -o ${OPTS} -l ${OPTL} -- ${DEFAULT_ARGUMENT} ${ARGUMENT}); then
     exit 1
 fi
@@ -1193,6 +1196,10 @@ while :; do
             nosigcheck=true
             shift 1
             ;;
+        --normwork)
+            normwork=true
+            shift 1
+            ;;
         --)
             shift
             break
index 5368093..1e95efb 100644 (file)
@@ -247,6 +247,10 @@ noaur=false
 # Change the default behavior of "--nosigcheck".
 nosigcheck=false
 
+# Do not remove working dir
+# Change the default behavior of "--normwork".
+normwork=false
+
 #-- Debug options --#
 
 # Set debug mode.