mirror of
https://github.com/shvedes/photoshop-linux.git
synced 2025-09-08 12:14:59 +00:00
added: uninstall function
This commit is contained in:
parent
0f9bd53282
commit
76dc948390
24
README.md
24
README.md
@ -4,9 +4,12 @@
|
|||||||
|
|
||||||
By providing this software, I do not give any guarantees of its work. This script was inspired by the work of [LinSoftWin](https://github.com/LinSoftWin/Photoshop-CC2022-Linux). This is only its adaptation. This script will be maintained and developed until I get bored and/or have free time. PR is welcome.
|
By providing this software, I do not give any guarantees of its work. This script was inspired by the work of [LinSoftWin](https://github.com/LinSoftWin/Photoshop-CC2022-Linux). This is only its adaptation. This script will be maintained and developed until I get bored and/or have free time. PR is welcome.
|
||||||
|
|
||||||
|
Please note that this code is a piece of garbage. Although it works in most cases, I do not guarantee that it will work completely. Please read the source before using it.
|
||||||
|
|
||||||
## Showcase
|
## Showcase
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
### What works
|
### What works
|
||||||
|
|
||||||
@ -35,22 +38,11 @@ By providing this software, I do not give any guarantees of its work. This scrip
|
|||||||
```bash
|
```bash
|
||||||
./photoshop.sh
|
./photoshop.sh
|
||||||
Usage: ./install.sh [options...] <path>
|
Usage: ./install.sh [options...] <path>
|
||||||
-a Use already existing Photoshop.tar.xz
|
-a Use already existing Photoshop.tar.xz
|
||||||
-i Install Photoshop
|
-i Install Photoshop
|
||||||
-h Show this help
|
-u <install path> Uninstall Photoshop
|
||||||
|
-h Show this help
|
||||||
```
|
```
|
||||||
## To Do
|
|
||||||
|
|
||||||
- [x] Properly implement loging
|
|
||||||
- [ ] Multi distro dependencies installer (for now only Arch Linux and CachyOS supported)
|
|
||||||
- [x] Create universal functions for repetitive actions
|
|
||||||
- [x] Implement colored logging in a different way, making the code more readable
|
|
||||||
- [ ] Allow the user to use a different source to download Photoshop
|
|
||||||
- [ ] Allow the user to skip checksum verification of downloaded files
|
|
||||||
- [ ] Uninstall script
|
|
||||||
- [x] More checks in the install script
|
|
||||||
- [x] Ability for the user to select a default installation folder
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Just follow me on GitHub :)
|
Just follow me on GitHub :)
|
||||||
|
70
photoshop.sh
70
photoshop.sh
@ -28,7 +28,7 @@ RESET="\e[0m" # Reset colors
|
|||||||
|
|
||||||
LOG="${BLUE}[LOG]${RESET}"
|
LOG="${BLUE}[LOG]${RESET}"
|
||||||
WARNING="${YELLOW}[WARNING]${RESET}"
|
WARNING="${YELLOW}[WARNING]${RESET}"
|
||||||
ERORR="${RED}[ERROR]${RESET}"
|
ERROR="${RED}[ERROR]${RESET}"
|
||||||
SUCCES="${GREEN}[SUCCES]${RESET}"
|
SUCCES="${GREEN}[SUCCES]${RESET}"
|
||||||
CHECK="${GREEN}[CHECK]${RESET}"
|
CHECK="${GREEN}[CHECK]${RESET}"
|
||||||
|
|
||||||
@ -60,10 +60,10 @@ on_interrupt() {
|
|||||||
|
|
||||||
if [ -d "$INSTALL_PATH" ]; then
|
if [ -d "$INSTALL_PATH" ]; then
|
||||||
if ask_user "Do you want to ${RED}delete${RESET} a newly created folder?"; then
|
if ask_user "Do you want to ${RED}delete${RESET} a newly created folder?"; then
|
||||||
if rm -rfv "${INSTALL_PATH:?}" 2>>./install_log.log; then
|
if rm -rfv "${INSTALL_PATH:?}" &>>./install_log.log; then
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -e "$ERORR The last command ended with an error."
|
echo -e "$ERROR The last command ended with an error."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -76,10 +76,14 @@ on_interrupt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_help() {
|
get_help() {
|
||||||
echo "Usage: ./install.sh [options...] <absolute path>"
|
echo "Usage: ./install.sh [options...] <path>"
|
||||||
echo " -a Use already existing Photoshop.tar.xz"
|
echo " -a Use already existing Photoshop.tar.xz"
|
||||||
echo " -i Install Photoshop"
|
echo " -i Install Photoshop"
|
||||||
|
echo " -u <install path> Uninstall Photoshop"
|
||||||
echo " -h Show this help"
|
echo " -h Show this help"
|
||||||
|
echo ""
|
||||||
|
echo "Please familiarize yourself with the script code before using it."
|
||||||
|
echo "I do not guarantee its correct operation. Also, it may contain potentially dangerous functions"
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_user() {
|
ask_user() {
|
||||||
@ -87,16 +91,16 @@ ask_user() {
|
|||||||
read -r -p "$(echo -e "${WARNING} $* (yes/no): ")" answer
|
read -r -p "$(echo -e "${WARNING} $* (yes/no): ")" answer
|
||||||
|
|
||||||
case "$answer" in
|
case "$answer" in
|
||||||
[yY] | [yY][eE][sS])
|
[yY]|[yY][eE][sS])
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
[nN] | [nN][oO])
|
|
||||||
|
[nN]|[nN][oO])
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Invalid input, try again"
|
echo "Invalid input, try again"
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -201,7 +205,7 @@ setup_wine() {
|
|||||||
echo -e "$LOG Downloading and installing core components for wine prefix. This could take some time."
|
echo -e "$LOG Downloading and installing core components for wine prefix. This could take some time."
|
||||||
|
|
||||||
if ! winetricks --unattended corefonts win10 vkd3d dxvk2030 msxml3 msxml6 gdiplus &>./install_log.log; then
|
if ! winetricks --unattended corefonts win10 vkd3d dxvk2030 msxml3 msxml6 gdiplus &>./install_log.log; then
|
||||||
echo -e "$ERORR Winetricks terminated with an error."
|
echo -e "$ERROR Winetricks terminated with an error."
|
||||||
echo -e "$ERROR Please open an issue by mentioning the contents of ${YELLOW}./install_log.log${RESET}."
|
echo -e "$ERROR Please open an issue by mentioning the contents of ${YELLOW}./install_log.log${RESET}."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -299,7 +303,7 @@ verify_path() {
|
|||||||
echo -e "$CHECK Directory '${YELLOW}${reformatted_path}${RESET}' exist."
|
echo -e "$CHECK Directory '${YELLOW}${reformatted_path}${RESET}' exist."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "$ERORR Path $reformatted_path does not exist!"
|
echo -e "$ERROR Path $reformatted_path does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -313,7 +317,7 @@ install_photoshop() {
|
|||||||
|
|
||||||
echo -e "$LOG Extracting Photoshop."
|
echo -e "$LOG Extracting Photoshop."
|
||||||
if ! tar xvf "$filename" &>>./install_log.log; then
|
if ! tar xvf "$filename" &>>./install_log.log; then
|
||||||
echo -e "$ERORR An error occurred while unpacking the archive."
|
echo -e "$ERROR An error occurred while unpacking the archive."
|
||||||
exit 1
|
exit 1
|
||||||
# TODO:
|
# TODO:
|
||||||
# A separate function so you don't have to write this code multiple times
|
# A separate function so you don't have to write this code multiple times
|
||||||
@ -332,7 +336,7 @@ install_photoshop() {
|
|||||||
echo -e "$LOG Using given local Photoshop archive."
|
echo -e "$LOG Using given local Photoshop archive."
|
||||||
|
|
||||||
if [[ ! "$LOCAL_ARCHIVE" = *.tar.xz ]]; then
|
if [[ ! "$LOCAL_ARCHIVE" = *.tar.xz ]]; then
|
||||||
echo -e "$ERORR Only tar.xz is accepted for now."
|
echo -e "$ERROR Only tar.xz is accepted for now."
|
||||||
exit 1
|
exit 1
|
||||||
# TODO:
|
# TODO:
|
||||||
# Allow user to use not only tar.xz / archive from another sources
|
# Allow user to use not only tar.xz / archive from another sources
|
||||||
@ -439,13 +443,32 @@ install_launcher() {
|
|||||||
echo "DXVK_STATE_CACHE_PATH=\"\$WINEPREFIX/dxvk_cache\""
|
echo "DXVK_STATE_CACHE_PATH=\"\$WINEPREFIX/dxvk_cache\""
|
||||||
echo "PHOTOSHOP=\"\$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021/photoshop.exe\""
|
echo "PHOTOSHOP=\"\$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021/photoshop.exe\""
|
||||||
echo ""
|
echo ""
|
||||||
echo "echo -e \"All logs are saved in \$LOG_FILE\""
|
echo "echo \"All logs are saved in \$LOG_FILE\""
|
||||||
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" &> \"\$LOG_FILE\" "
|
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" &> \"\$LOG_FILE\" "
|
||||||
} >"$LAUNCHER"
|
} >"$LAUNCHER"
|
||||||
|
|
||||||
chmod +x "$LAUNCHER"
|
chmod +x "$LAUNCHER"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uninstall() {
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
if ask_user "The script will delete '$1'. Continue?"; then
|
||||||
|
echo -e "$LOG Uninstalling old installation."
|
||||||
|
rm -rfv "${1:?}" &>>./uninstall_log.log
|
||||||
|
|
||||||
|
echo -e "$LOG Removing launcher & app icon."
|
||||||
|
[ -d "$HOME/.local/bin/photoshop" ] && rm -rfv $HOME/.local/bin/photoshop &> ./uninstall_log.log
|
||||||
|
[ -f "$XDG_DATA_HOME/applications/photoshop.desktop" ] && rm -rv $XDG_DATA_HOME/applications/photoshop.desktop &> ./uninstall_log.log
|
||||||
|
echo -e "$SUCCES Photoshop was successfully deleted."
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "$ERROR "$1" does not exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if ! check_deps; then
|
if ! check_deps; then
|
||||||
install_deps
|
install_deps
|
||||||
@ -466,7 +489,7 @@ main() {
|
|||||||
install_desktop_entry
|
install_desktop_entry
|
||||||
install_launcher
|
install_launcher
|
||||||
|
|
||||||
echo -e "$SUCCES Photoshop is successfully installed."
|
echo -e "$SUCCES Photoshop was successfully installed."
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -n $1 && $1 != -* ]]; then
|
if [[ -n $1 && $1 != -* ]]; then
|
||||||
@ -480,25 +503,20 @@ if [ -z "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts "a:i:h" opt; do
|
while getopts "a:i:u:h" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
a)
|
a)
|
||||||
LOCAL_ARCHIVE="$OPTARG"
|
LOCAL_ARCHIVE="$OPTARG" ;;
|
||||||
;;
|
|
||||||
h)
|
h)
|
||||||
get_help
|
get_help ;;
|
||||||
;;
|
|
||||||
i)
|
i)
|
||||||
INSTALL_PATH="$OPTARG"
|
INSTALL_PATH="$OPTARG" ;;
|
||||||
;;
|
u)
|
||||||
|
uninstall "$OPTARG" && exit 0;;
|
||||||
:)
|
:)
|
||||||
echo "Option -${OPTARG} requires an argument"
|
echo "Option -${OPTARG} requires an argument" && exit 1 ;;
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
?)
|
?)
|
||||||
echo "Invalid option: -$OPTARG Use -h for help."
|
echo "Invalid option: -$OPTARG Use -h for help." && exit 1 ;;
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user