diff options
Diffstat (limited to 'macinstall')
-rwxr-xr-x | macinstall | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/macinstall b/macinstall index 277fbb9ac914..e5cf0db368cb 100755 --- a/macinstall +++ b/macinstall @@ -160,31 +160,9 @@ ERR="\E[31;40m[ERR]${EchoReset}" #echo -e "$OK $WARN $ERR" #path_cfg must be '/' terminated -#path_cfg="../etc-macinstall.d/" -path_cfg="/etc/macinstall.d/" -#if last char is not '/' add it -[[ ${path_cfg:${#path_cfg}-1:1} != "/" ]] && path_cfg="$path_cfg/" - - filename_cfg="macinstall.conf" - -#path_dest must be '/' terminated -#path_dest="/home/simona/My Work/my-pkg simonascripts/root-test/" -path_dest="$HOME/test/" -[[ "$flagForceRealWork" == true ]] && { echo "$WARN Using real path / for destination..."; path_dest="/"; } -#if last char is not '/' add it -[[ ${path_dest:${#path_dest}-1:1} != "/" ]] && path_dest="$path_dest/" - -postfix_bak_file_name=".bak" - -#cfg related -prop_cfg_file_copy_num="CopyFilesNum" -prop_cfg_dir_copy_num="CopyDirectoriesNum" -prop_cfg_file_copy="CopyFile" -prop_cfg_dir_copy="CopyDirectory" -prop_cfg_write_sem="WriteSemaphore" -prop_cfg_read_sem="AllowOnlyIfPreviousMacIs" - +path_cfg="/etc/macinstall.d/" +[[ ${path_cfg:${#path_cfg}-1:1} != "/" ]] && path_cfg="$path_cfg/" #if last char is not '/' add it if [[ ! -d $path_cfg ]] ; then mkdir -p $path_cfg [[ $? -ne 0 ]] && { echo -e "$ERR Fail '$path_cfg' mkdir cmd creation !!"; exit 1; } @@ -194,11 +172,26 @@ if [[ ! -r $path_cfg$filename_cfg ]] ; then [[ $? -ne 0 ]] && { echo -e "$ERR Fail '$path_cfg$filename_cfg' touch cmd creation !!"; exit 1; } fi +#path_dest must be '/' terminated +path_dest="$HOME/test/" +[[ "$flagNoTest" == true ]] && { echo "$WARN Using real path / for destination..."; path_dest="/"; } +[[ ${path_dest:${#path_dest}-1:1} != "/" ]] && path_dest="$path_dest/" #if last char is not '/' add it if [[ ! -d $path_dest ]] ; then + [[ ${path_dest:0:5} == "/home" && ! -d "/home" ]] && { echo "$ERR Path '/home' missing. (For / use) Exit."; exit 1; } mkdir -p $path_dest [[ $? -ne 0 ]] && { echo -e "$ERR Fail $path_dest mkdir cmd creation !!"; exit 1; } fi +postfix_bak_file_name=".bak" + +#cfg related +prop_cfg_file_copy_num="CopyFilesNum" +prop_cfg_dir_copy_num="CopyDirectoriesNum" +prop_cfg_file_copy="CopyFile" +prop_cfg_dir_copy="CopyDirectory" +prop_cfg_write_sem="WriteSemaphore" +prop_cfg_read_sem="AllowOnlyIfPreviousMacIs" + if [[ "$flagAskConfirm" == true ]] ; then echo -n "Continue? (Y/N): "; read ask [[ ! $ask =~ ^(yes|y|YES|y|s|S|si|SI|sì)$ ]] && { echo "Exit forced by user."; exit 0; } |