diff --git a/scripts/PhotoshopSetup.sh b/scripts/PhotoshopSetup.sh index 1209fc3..128787c 100755 --- a/scripts/PhotoshopSetup.sh +++ b/scripts/PhotoshopSetup.sh @@ -10,8 +10,7 @@ function main() { is64 - #make sure aria2c and wine package is already installed - # package_installed aria2c + #make sure wine and winetricks package is already installed package_installed wine package_installed md5sum package_installed winetricks diff --git a/scripts/sharedFuncs.sh b/scripts/sharedFuncs.sh index bc5286f..bc67164 100755 --- a/scripts/sharedFuncs.sh +++ b/scripts/sharedFuncs.sh @@ -1,15 +1,25 @@ +#has tow mode [pkgName] [mode=summary] function package_installed() { which $1 &> /dev/null local pkginstalled="$?" - if [ "$pkginstalled" -eq 0 ];then - show_message "package\033[1;36m $1\e[0m is installed..." - else - warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed" - ask_question "would you continue?" "N" - if [ "$question_result" == "no" ];then - echo "exit..." - exit 5 + + if [ "$2" == "summary" ];then + if [ "$pkginstalled" -eq 0 ];then + echo "true" + else + echo "false" + fi + else + if [ "$pkginstalled" -eq 0 ];then + show_message "package\033[1;36m $1\e[0m is installed..." + else + warning "package\033[1;33m $1\e[0m is not installed.\nplease make sure it's already installed" + ask_question "would you continue?" "N" + if [ "$question_result" == "no" ];then + echo "exit..." + exit 5 + fi fi fi } @@ -131,8 +141,8 @@ function replacement() { function install_photoshopSE() { local filename="photoshopCC-V19.1.6-2018x64.tgz" local filemd5="b63f6ed690343ee12b6195424f94c33f" - local filelink="https://victor.poshtiban.io/p/gictor/photoshopCC/photoshopCC-V19.1.6-2018x64.tgz" - # local filelink="http://127.0.0.1:8080/photoshopCC-V19.1.6-2018x64.tgz" + # local filelink="https://victor.poshtiban.io/p/gictor/photoshopCC/photoshopCC-V19.1.6-2018x64.tgz" + local filelink="http://127.0.0.1:8080/photoshopCC-V19.1.6-2018x64.tgz" local filepath="$CACHE_PATH/$filename" download_component $filepath $filemd5 $filelink $filename @@ -204,7 +214,7 @@ function export_var() { function download_component() { local tout=0 while true;do - if [ $tout -ge 2 ];then + if [ $tout -ge 3 ];then error "sorry something went wrong during download $4" fi if [ -f $1 ];then @@ -218,14 +228,25 @@ function download_component() { fi else show_message "downloading $4 ..." - # aria2c -c -x 8 -d $CACHE_PATH -o $4 $3 - wget $3 -P $CACHE_PATH - if [ $? -eq 0 ];then - notify-send "$4 download completed" -i "download" + pkgres=$(package_installed aria2c "summary") + if [ "$pkgres" == "true" ];then + show_message "using aria2c to download $4" + aria2c -c -x 8 -d "$CACHE_PATH" -o $4 $3 + + if [ $? -eq 0 ];then + notify-send "$4 download completed" -i "download" + fi + else + show_message "using wget to download $4" + wget "$3" -P "$CACHE_PATH" + + if [ $? -eq 0 ];then + notify-send "$4 download completed" -i "download" + fi fi ((tout++)) fi - done + done } function rmdir_if_exist() { diff --git a/scripts/uninstaller.sh b/scripts/uninstaller.sh index 6346b19..4266401 100755 --- a/scripts/uninstaller.sh +++ b/scripts/uninstaller.sh @@ -51,8 +51,9 @@ main() { ask_question "would you delete cache directory?" "N" if [ "$result" == "yes" ];then rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory" + show_message2 "cache directory removed." else - echo "nice, you can copy component data and use them later for photoshop installation" + echo "nice, you can use downloaded data later for photoshop installation" fi else echo "cache directory Not Found!"