diff --git a/scripts/cameraRawInstaller.sh b/scripts/cameraRawInstaller.sh index 3d3fcae..525500d 100755 --- a/scripts/cameraRawInstaller.sh +++ b/scripts/cameraRawInstaller.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash function main(){ + source "sharedFuncs.sh" + SCR_PATH="$HOME/.photoshopCCV19" CACHE_PATH="$HOME/.cache/photoshopCCV19" WINE_PATH="$SCR_PATH/wine-3.4" @@ -11,49 +13,12 @@ function main(){ check_ps_installed - exportVar + export_var install_cameraRaw } function check_ps_installed(){ - ([ -d "$SCR_PATH" ] && [ -d "$CACHE_PATH" ] && [ -d "$WINE_PATH" ] && [ -d "$WINE_PREFIX" ] && show_message "photoshop installed") || error "photoshop not found you should intsall photoshop first" -} - -function exportVar(){ - export WINEPREFIX="$WINE_PREFIX" - export PATH="$WINE_PATH/bin:$PATH" - export LD_LIBRARY_PATH="$WINE_PATH/lib:$LD_LIBRARY_PATH" - #export WINEDLLOVERRIDES="winemenubuilder.exe=d" - export WINESERVER="$WINE_PATH/bin/wineserver" - export WINELOADER="$WINE_PATH/bin/wine" - export WINEDLLPATH="$WINE_PATH/lib/wine" -} - -#parameters is [PATH] [CheckSum] [URL] [FILE NAME] -function download_component(){ - local tout=0 - while true;do - if [ $tout -ge 2 ];then - error "sorry somthing went wrong during download $4" - fi - if [ -f $1 ];then - local FILE_ID=$(md5sum $1 | cut -d" " -f1) - if [ "$FILE_ID" == $2 ];then - show_message "\033[1;36m$4\e[0m detected" - return 0 - else - show_message "md5 is not match" - rm $1 - fi - else - show_message "downloading $4 ..." - aria2c -c -x 8 -d $CACHE_PATH -o $4 $3 - if [ $? -eq 0 ];then - notify-send "$4 download completed" -i "download" - fi - ((tout++)) - fi - done + ([ -d "$SCR_PATH" ] && [ -d "$CACHE_PATH" ] && [ -d "$WINE_PATH" ] && [ -d "$WINE_PREFIX" ] && show_message2 "photoshop installed") || error2 "photoshop not found you should intsall photoshop first" } function install_cameraRaw(){ @@ -65,26 +30,13 @@ function install_cameraRaw(){ download_component $filepath $filemd5 $filelink $filename echo "===============| Adobe Camera Raw v12 |===============" >> "$SCR_PATH/wine-error.log" - show_message "Adobe Camera Raw v12 installation..." + show_message2 "Adobe Camera Raw v12 installation..." - wine $filepath &>> "$SCR_PATH/wine-error.log" || error "sorry something went wrong during Adobe Camera Raw v12 installation" + wine $filepath &>> "$SCR_PATH/wine-error.log" || error2 "sorry something went wrong during Adobe Camera Raw v12 installation" notify-send "Adobe Camera Raw v12 installed successfully" -i "photoshop" - show_message "Adobe Camera Raw v12 installed..." + show_message2 "Adobe Camera Raw v12 installed..." unset filename filemd5 filelink filepath } -function show_message(){ - echo -e "$@" -} - -function error(){ - echo -e "\033[1;31merror:\e[0m $@" - exit 1 -} - -function warning(){ - echo -e "\033[1;33mWarning:\e[0m $@" -} - main diff --git a/scripts/sharedFuncs.sh b/scripts/sharedFuncs.sh index 0c1e4ec..de16522 100644 --- a/scripts/sharedFuncs.sh +++ b/scripts/sharedFuncs.sh @@ -33,6 +33,14 @@ function warning(){ setup_log "$@" } +function warning2(){ + echo -e "\033[1;33mWarning:\e[0m $@" +} + +function show_message2(){ + echo -e "$@" +} + function launcher(){ local launcher_path="$PWD/launcher.sh" rmdir_if_exist "$SCR_PATH/launcher"