directory -d and cache path -c flags added

This commit is contained in:
victor 2020-05-29 20:35:54 +04:30
parent dfbe60fdd1
commit 011de4fb3d
9 changed files with 123 additions and 54 deletions

View File

@ -1,18 +1,13 @@
#!/usr/bin/env bash
source "sharedFuncs.sh"
function main(){
source "sharedFuncs.sh"
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
mkdir -p $SCR_PATH
mkdir -p $CACHE_PATH
setup_log "================| script executed |================"
check_arg $1
is64
#make sure aria2c and wine package is already installed
@ -63,6 +58,7 @@ function main(){
# winetricks atmlib corefonts fontsmooth=rgb gdiplus vcrun2008 vcrun2010 vcrun2012 vcrun2013 vcrun2015 atmlib msxml3 msxml6 gdiplus
winetricks atmlib fontsmooth=rgb vcrun2008 vcrun2010 vcrun2012 vcrun2013 vcrun2015 atmlib msxml3 msxml6
#install photoshop
sleep 3
install_photoshopSE
@ -86,4 +82,6 @@ function main(){
sleep 30
}
main $# $@
check_arg $@
save_paths
main

View File

@ -1,18 +1,14 @@
#!/usr/bin/env bash
source "sharedFuncs.sh"
function main(){
source "sharedFuncs.sh"
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
mkdir -p $SCR_PATH
mkdir -p $CACHE_PATH
setup_log "================| script executed |================"
check_arg $1
is64
#make sure aria2c and wine package is already installed
@ -227,4 +223,6 @@ function install_vcrun2008(){
unset filename filemd5 filelink filepath
}
main $# $@
check_arg $@
save_paths
main

View File

@ -3,8 +3,7 @@ function main(){
source "sharedFuncs.sh"
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
load_paths
WINE_PATH="$SCR_PATH/wine-3.4"
WINE_PREFIX="$SCR_PATH/prefix"

19
scripts/installapp.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
function main(){
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
WINE_PATH="$SCR_PATH/wine-3.4"
RESOURCES_PATH="$SCR_PATH/resources"
WINE_PREFIX="$SCR_PATH/prefix"
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"
wine "$1"
}
main "$1"

View File

@ -6,8 +6,10 @@ fi
notify-send "photoshop started" -i "photoshop"
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
# SCR_PATH="$HOME/.photoshopCCV19"
# CACHE_PATH="$HOME/.cache/photoshopCCV19"
SCR_PATH="pspath"
CACHE_PATH="pscache"
WINE_PATH="$SCR_PATH/wine-3.4"
@ -23,4 +25,4 @@ export WINESERVER="$WINE_PATH/bin/wineserver"
export WINELOADER="$WINE_PATH/bin/wine"
export WINEDLLPATH="$WINE_PATH/lib/wine"
wine $HOME/.photoshopCCV19/prefix/drive_c/users/$USER/PhotoshopSE/Photoshop.exe
wine "$SCR_PATH/prefix/drive_c/users/$USER/PhotoshopSE/Photoshop.exe"

View File

@ -1,7 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=photoshop
Exec=bash gictorbit/.photoshopCCV19/launcher/launcher.sh
Exec=bash pspath/launcher/launcher.sh
Type=Application
StartupNotify=true
Comment=photoshop cc for linux

83
scripts/sharedFuncs.sh Normal file → Executable file
View File

@ -47,13 +47,21 @@ function show_message2(){
}
function launcher(){
#create launcher script
local launcher_path="$PWD/launcher.sh"
rmdir_if_exist "$SCR_PATH/launcher"
local launcher_dest="$SCR_PATH/launcher"
rmdir_if_exist "$launcher_dest"
if [ -f "$launcher_path" ];then
show_message "launcher.sh detected..."
cp "$launcher_path" "$SCR_PATH/launcher" || error "can't copy launcher"
chmod +x "$SCR_PATH/launcher/launcher.sh"
cp "$launcher_path" "$launcher_dest" || error "can't copy launcher"
sed -i "s|pspath|$SCR_PATH|g" "$launcher_dest/launcher.sh" && sed -i "s|pscache|$CACHE_PATH|g" "$launcher_dest/launcher.sh" || error "can't edit launcher script"
chmod +x "$SCR_PATH/launcher/launcher.sh" || error "can't chmod launcher script"
else
error "launcher.sh Note Found"
fi
@ -70,7 +78,7 @@ function launcher(){
sudo rm "$desktop_entry_dest"
fi
sudo cp "$desktop_entry" "/usr/share/applications" || error "can't copy desktop entry"
sudo sed -i "s|gictorbit|$HOME|g" "$desktop_entry_dest" || error "can't edit desktop entry"
sudo sed -i "s|pspath|$SCR_PATH|g" "$desktop_entry_dest" || error "can't edit desktop entry"
else
error "desktop entry Not Found"
fi
@ -83,7 +91,7 @@ function launcher(){
fi
sudo ln -s "$SCR_PATH/launcher/launcher.sh" "/usr/local/bin/photoshop" || error "can't create photoshop command"
unset desktop_entry desktop_entry_dest launcher_path
unset desktop_entry desktop_entry_dest launcher_path launcher_dest
}
function replacement(){
@ -274,19 +282,54 @@ function download_component(){
function rmdir_if_exist(){
if [ -d "$1" ];then
rm -rf $1
rm -rf "$1"
show_message "\033[0;36m$1\e[0m directory exists deleting it..."
fi
mkdir $1
mkdir "$1"
show_message "create\033[0;36m $1\e[0m directory..."
}
function check_arg(){
if [ $1 != 0 ]
then
error "It haven't any parameter just execute script"
while getopts "hd:c:" OPTION; do
case $OPTION in
d)
PARAMd="$OPTARG"
SCR_PATH=$(readlink -f "$PARAMd")
dashd=1
echo "install path is $SCR_PATH"
;;
c)
PARAMc="$OPTARG"
CACHE_PATH=$(readlink -f "$PARAMc")
dashc=1
echo "cahce is $CACHE_PATH"
;;
h)
usage
;;
*)
echo "wrong argument"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
if [[ $# != 0 ]];then
usage
error2 "unknown argument"
fi
if [[ $dashd != 1 ]] ;then
echo "-d not define default directory used..."
SCR_PATH="$HOME/.photoshopCCV19"
fi
if [[ $dashc != 1 ]];then
echo "-c not define default directory used..."
CACHE_PATH="$HOME/.cache/photoshopCCV19"
fi
show_message "argument checked..."
}
function is64(){
@ -321,3 +364,21 @@ function ask_question(){
fi
fi
}
function usage(){
echo "USAGE: [-c cache directory] [-d installation directory]"
}
function save_paths(){
local datafile="$HOME/.psdata.txt"
echo "$SCR_PATH" > "$datafile"
echo "$CACHE_PATH" >> "$datafile"
unset datafile
}
function load_paths(){
local datafile="$HOME/.psdata.txt"
SCR_PATH=$(head -n 1 "$datafile")
CACHE_PATH=$(tail -n 1 "$datafile")
unset datafile
}

View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
source "sharedFuncs.sh"
main(){
check_arg $1
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
CMD_PATH="/usr/local/bin/photoshop"
ENTRY_PATH="/usr/share/applications/photoshop.desktop"
@ -18,7 +18,7 @@ main(){
#remove photoshop directory
if [ -d "$SCR_PATH" ];then
echo "remove photoshop directory..."
rm -rf "$SCR_PATH" || error "couldn't remove photoshop directory"
rm -r "$SCR_PATH" || error2 "couldn't remove photoshop directory"
sleep 4
else
echo "photoshop directory Not Found!"
@ -28,7 +28,7 @@ main(){
#Unlink command
if [ -L "$CMD_PATH" ];then
echo "remove launcher command..."
sudo unlink "$CMD_PATH" || error "couln't remove launcher command"
sudo unlink "$CMD_PATH" || error2 "couln't remove launcher command"
else
echo "launcher command Not Found!"
fi
@ -36,7 +36,8 @@ main(){
#delete desktop entry
if [ -f "$ENTRY_PATH" ];then
echo "remove dekstop entry...."
sudo rm "$ENTRY_PATH" || error "couldn't remove desktop entry"
echo "$SCR_PATH"
sudo rm "$ENTRY_PATH" || error2 "couldn't remove desktop entry"
else
echo "desktop entry Not Found!"
fi
@ -49,7 +50,7 @@ main(){
echo "--------------------------------"
ask_question "would you delete cache directory?" "N"
if [ "$result" == "yes" ];then
rm -rf "$CACHE_PATH" || error "couldn't remove cache directory"
rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory"
else
echo "nice, you can copy component data and use them later for photoshop installation"
fi
@ -59,17 +60,6 @@ main(){
}
function error(){
echo -e "\033[1;31merror:\e[0m $@"
exit 1
}
function check_arg(){
if [ $1 != 0 ];then
error "please just run script without any argument"
fi
}
#parameters [Message] [default flag [Y/N]]
function ask_question(){
result=""
@ -90,4 +80,5 @@ function ask_question(){
fi
}
main $# $@
load_paths
main

View File

@ -1,7 +1,8 @@
#!/usr/bin/env bash
source "sharedFuncs.sh"
function main(){
SCR_PATH="$HOME/.photoshopCCV19"
CACHE_PATH="$HOME/.cache/photoshopCCV19"
load_paths
WINE_PATH="$SCR_PATH/wine-3.4"
RESOURCES_PATH="$SCR_PATH/resources"
WINE_PREFIX="$SCR_PATH/prefix"