mirror of
https://github.com/shvedes/photoshop-linux.git
synced 2025-07-04 02:15:07 +00:00
Updated version. Not final version yet
This commit is contained in:
parent
83d33e9494
commit
b12c7ed9c4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
uninstall.sh
|
||||
install.sh.bak
|
||||
install_log.log
|
||||
*.tar.xz
|
||||
|
31
README.md
31
README.md
@ -6,18 +6,19 @@ By providing this software, I do not give any guarantees of its work. This scrip
|
||||
|
||||
## Showcase
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
### What works
|
||||
|
||||
- Drag and drop
|
||||
- Mime type (right click menu, see [here](https://github.com/user-attachments/assets/eb5f7ab3-fb75-47e7-841b-a763ca5e3382))
|
||||
- Clipboard image pasting
|
||||
- Mime type association (right click menu, see [here](https://github.com/user-attachments/assets/eb5f7ab3-fb75-47e7-841b-a763ca5e3382))
|
||||
- GPU acceleration
|
||||
|
||||
**Tested on:**
|
||||
- Arch Linux
|
||||
- KDE Plasma 6.1.5 (Wayland)
|
||||
- KDE Plasma 6.2 (Wayland)
|
||||
- wine 9.19
|
||||
- AMD GPU
|
||||
|
||||
@ -26,15 +27,27 @@ By providing this software, I do not give any guarantees of its work. This scrip
|
||||
- When hovering on toolbar item to see its instructions, black bars may appear around
|
||||
- Wine's experimental wayland driver is completely broken
|
||||
|
||||
## Installation
|
||||
### Notes
|
||||
|
||||
- [ ] If you have **Papirus Icons** installed, the script will use an icon that is already in that pack. If not, the script will download an icon from the internet and use it for the `.desktop` entry.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
git clone https://github.com/shvedes/photoshop-linux
|
||||
cd photoshop-linux
|
||||
./install.sh <installation path>
|
||||
./install.sh
|
||||
Usage: ./install.sh [options...] <path>
|
||||
-a Use already existing Photoshop.tar.xz
|
||||
-i Install Photoshop
|
||||
-h Show this help
|
||||
```
|
||||
## To Do
|
||||
|
||||
- [ ] Properly implement logging
|
||||
- [ ] Multi distro dependencies installer (for now only Arch Linux is supported)
|
||||
- [ ] Create universal functions for repetitive actions
|
||||
- [ ] 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
|
||||
- [ ] More checks in the install script
|
||||
- [ ] Ability for the user to select a default installation folder
|
||||
- [x] More checks in the install script
|
||||
- [x] Ability for the user to select a default installation folder
|
||||
|
621
install.sh
621
install.sh
@ -1,43 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Adapted script from LinSoftWin/Photoshop-CC2022-Linux
|
||||
# This work and script was adapted by the work of user LinSoftWin. If it wasn't for him - it wouldn't have happened.
|
||||
# This script downloads a PIRATE version of Photoshop, because it is not possible to run the actual version from Adobe Creative Cloud.
|
||||
# Use it at your own risk. The license applies only to the files in this repository.
|
||||
# I am not responsible for any other files downloaded from other links using the script.
|
||||
# If the link becomes inactive - it will be replaced by another hosting. Checksums of uploaded files will also be updated.
|
||||
|
||||
export WINEPREFIX="$1"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
# TODO
|
||||
# - Indicate download progress
|
||||
# - Maybe use `aria2` for downloading files?
|
||||
# - Multi distro dependencies installer
|
||||
# - Implement logging adequately
|
||||
|
||||
LOG_NORMAL="\e[1;97m"
|
||||
LOG_ERROR="\e[1;31m"
|
||||
LOG_SUCCESS="\e[1;32m"
|
||||
LOG_RESET="\e[0m"
|
||||
# In case the user does not use the XDG Base Directory Specification
|
||||
# https://specifications.freedesktop.org/basedir-spec/latest
|
||||
XDG_DATA_HOME="$HOME/.local/share"
|
||||
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
FILENAME="Photoshop.tar.xz"
|
||||
LOG_NORMAL="\e[1;34m" # Blue
|
||||
LOG_ERROR="\e[1;31m" # Red
|
||||
LOG_WARNING="\e[1;33m" # Yellow
|
||||
LOG_SUCCESS="\e[1;32m" # Green
|
||||
LOG_RESET="\e[0m" # Reset colors
|
||||
|
||||
# CHECKS & OTHER FUNCTIONS
|
||||
# ###################################################################
|
||||
#
|
||||
|
||||
# Photoshop URL
|
||||
PHOTOSHOP_URL="https://spyderrock.com/kMnq2220-AdobePhotoshop2021.xz"
|
||||
|
||||
# sha256 checksum
|
||||
CHECKSUM="8321b969161f2d2ad736067320d493c5b6ae579eaab9400cd1fda6871af2c033"
|
||||
|
||||
LAUNCHER="$HOME/.local/bin/photoshop.sh"
|
||||
LOCAL_ARCHIVE=""
|
||||
ICON=""
|
||||
|
||||
trap 'on_error ${LINENO} "$BASH_COMMAND"' ERR
|
||||
trap on_interrupt SIGINT
|
||||
|
||||
on_interrupt() {
|
||||
echo -e "\n${LOG_NORMAL}User intrrupt! Cleaning up..${LOG_RESET}"
|
||||
trap "exit 1" SIGINT
|
||||
|
||||
if [ -f "./$FILENAME" ]; then
|
||||
rm "$FILENAME"
|
||||
elif [ -d "./Adobe Photoshop 2021" ]; then
|
||||
rm -rf "./Adobe Photoshop 2021"
|
||||
echo -e "\n${LOG_WARNING}[WARNING]${LOG_RESET} User intrrupt!"
|
||||
|
||||
if [ -d "$INSTALL_PATH" ]; then
|
||||
while true; do
|
||||
read -p "$(echo -e "$LOG_WARNING")[WARNING]$(echo -e "$LOG_RESET") Do you want to $(echo -e "$LOG_ERROR")delete$(echo -e "$LOG_RESET") the just created wine prefix? (yes/no): " answer
|
||||
|
||||
case "$answer" in
|
||||
[Yy]es|y)
|
||||
if rm -rf "${INSTALL_PATH:?}"; then
|
||||
exit 0
|
||||
else
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} The last command ended with an error."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
[Nn]o|n)
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} Invalid input!"
|
||||
esac
|
||||
done
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -d "$WINEPREFIX" ] && rm -rf "$WINEPREFIX"
|
||||
rm -rf "$TEMP_DIR"
|
||||
exit 0
|
||||
}
|
||||
|
||||
on_error() {
|
||||
local lineno="$1"
|
||||
local command="$2"
|
||||
echo -e "${LOG_ERROR}[LOG] error in the line ${lineno}${LOG_RESET}: command '$command'"
|
||||
exit 1
|
||||
get_help() {
|
||||
echo "Usage: ./install.sh [options...] <absolute path>"
|
||||
echo " -a Use already existing Photoshop.tar.xz"
|
||||
echo " -i Install Photoshop"
|
||||
echo " -h Show this help"
|
||||
}
|
||||
|
||||
check_dependencies() {
|
||||
# Imagemagick is needed in case you are not using Papirus Icons.
|
||||
# One of the functions will load a Photoshop `.webp` icon and convert it to `.png`. The `.png` file will be used in the `.desktop` entry.
|
||||
check_deps() {
|
||||
declare -A packages=(
|
||||
["curl"]="curl"
|
||||
["wine"]="wine"
|
||||
@ -45,7 +85,7 @@ check_dependencies() {
|
||||
["magick"]="imagemagick"
|
||||
)
|
||||
|
||||
local missed_packages=()
|
||||
missed_packages=()
|
||||
|
||||
for bin in "${!packages[@]}"; do
|
||||
if ! command -v "$bin" > /dev/null; then
|
||||
@ -54,214 +94,381 @@ check_dependencies() {
|
||||
done
|
||||
|
||||
if [ ${#missed_packages[@]} -eq 0 ]; then
|
||||
echo -e "${LOG_SUCCESS}[LOG] All dependencies are installed${LOG_RESET}" && sleep 1
|
||||
echo -e "${LOG_SUCCESS}[CHECK]${LOG_RESET} All dependencies are installed."
|
||||
else
|
||||
echo -e "${LOG_ERROR}Missing dependencies:${LOG_NORMAL} ${missed_packages[@]}${LOG_RESET}"
|
||||
exit 1
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} Missing dependencies: ${LOG_WARNING}${missed_packages[*]}${LOG_RESET}."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
setup_wine() {
|
||||
install_deps() {
|
||||
local os="$(uname -n)"
|
||||
|
||||
mkdir "$WINEPREFIX"
|
||||
case "$os" in
|
||||
"archlinux")
|
||||
# To display the list of packages correctly, we need to format the string.
|
||||
# Otherwise `read` will not display the whole list of packages and will stop in the middle of the line.
|
||||
missing_packages_str=$(printf "%s " "${missed_packages[@]}")
|
||||
# Here we can do without it, but in that case there will be an annoying space before the period at the end of the package listing.
|
||||
missing_packages_str=${missing_packages_str% }
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Folder $WINEPREFIX created${LOG_RESET}"
|
||||
echo -e "${LOG_NORMAL}[LOG] Initializing wine and setting up winetricks.. It may take some time${LOG_RESET}"
|
||||
|
||||
wineboot &> /dev/null
|
||||
winetricks fontsmooth=rgb win10 gdiplus msxml3 msxml6 atmlib corefonts dxvk win10 vkd3d d3d12 vkd3d &> /dev/null
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Downloading Visual C++ runtime...${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x64
|
||||
curl -s "https://aka.ms/vs/17/release/vc_redist.x64.exe" -o "${TEMP_DIR}/vc_redist_2015_2022_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2015_2022_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x86
|
||||
curl -s "https://aka.ms/vs/17/release/vc_redist.x86.exe" -o "${TEMP_DIR}/vc_redist_2015_2022_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2015_2022_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x64
|
||||
curl -sL "https://aka.ms/highdpimfc2013x64enu" -o "${TEMP_DIR}/vc_redist_2013_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2013_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x86
|
||||
curl -sL "https://aka.ms/highdpimfc2013x86enu" -o "${TEMP_DIR}/vc_redist_2013_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2013_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x64
|
||||
curl -s "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe" -o "${TEMP_DIR}/vc_redist_2012_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2012_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x86
|
||||
curl -s "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe" -o "${TEMP_DIR}/vc_redist_2012_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2012_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x64
|
||||
curl -s "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe" -o "${TEMP_DIR}/vc_redist_2010_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2010_x64.exe${LOG_RESET}"
|
||||
# 2010 x86
|
||||
curl -s "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe" -o "${TEMP_DIR}/vc_redist_2010_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2010_x86.exe${LOG_RESET}"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing Visual C++...${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2015_2022_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2015_2022_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2015_2022_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2015_2022_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2013_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2013_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2013_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2013_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2012_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2012_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2012_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2012_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2010_x64.exe" /q /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2010_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2010_x86.exe" /q /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2010_x86.exe${LOG_RESET}"
|
||||
|
||||
winecfg -v win10 &> /dev/null
|
||||
while true; do
|
||||
# Yeah yeah, I know it's unreadable.
|
||||
# But it's beautiful!
|
||||
read -p "$(echo -e "$LOG_WARNING")[WARNING]$(echo -e "$LOG_RESET") Script will execute: '$(echo -e "$LOG_ERROR")sudo$(echo -e "$LOG_RESET") $(echo -e "$LOG_NORMAL")pacman -S $(echo -e "$LOG_WARNING")${missing_packages_str}$(echo -e "$LOG_RESET")'. Proceed? (yes/no): " answer
|
||||
|
||||
case "$answer" in
|
||||
[Yy]es|y)
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing missing dependencies"
|
||||
if ! sudo pacman -S "${missed_packages[@]}"; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Pacman terminated with an error."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Missing dependencies was installed"
|
||||
break
|
||||
;;
|
||||
[Nn]o|n)
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Exiting"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} Invalid input!"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} For now only ${LOG_NORMAL}Arch Linux${LOG_RESET} is supported."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
download_ps() {
|
||||
local url="https://spyderrock.com/kMnq2220-AdobePhotoshop2021.xz"
|
||||
# https://github.com/LinSoftWin/Photoshop-CC2022-Linux
|
||||
local checksum="8321b969161f2d2ad736067320d493c5b6ae579eaab9400cd1fda6871af2c033"
|
||||
# MAIN SCRIPT
|
||||
# ###################################################################
|
||||
#
|
||||
|
||||
is_path_exists() {
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} The specified path '$1' already exists."
|
||||
|
||||
if [ -f "./$FILENAME" ]; then
|
||||
echo -e "${LOG_NORMAL}[LOG] Found existing archive. Comparing checksums${LOG_RESET}"
|
||||
local actual_checksum="$(sha256sum $FILENAME | awk '{print $1}')"
|
||||
while true; do
|
||||
read -p "$(echo -e "$LOG_WARNING")[WARNING]$(echo -e "$LOG_RESET") Do you want to $(echo -e "$LOG_ERROR")delete$(echo -e "$LOG_RESET") previous installation? (yes/no): " answer
|
||||
|
||||
if [ "$actual_checksum" != "$checksum" ]; then
|
||||
echo -e "${LOG_ERROR}[LOG] Corrupted archive!${LOG_NORMAL} Redownloading (1.1G)${LOG_RESET}"
|
||||
rm "./$FILENAME"
|
||||
curl -s "$url" -o "$FILENAME"
|
||||
else
|
||||
echo -e "${LOG_SUCCESS}[LOG] Done${LOG_SUCCESS}"
|
||||
fi
|
||||
else
|
||||
echo -e "${LOG_NORMAL}[LOG] Downloading Photoshop (1.1G)${LOG_RESET}"
|
||||
curl -s "$url" -o "$FILENAME"
|
||||
echo -e "${LOG_SUCCESS}[LOG] Downloaded Photoshop${LOG_RESET}"
|
||||
|
||||
actual_checksum="$(sha256sum $FILENAME | awk '{print $1}')"
|
||||
echo -e "${LOG_NORMAL}[LOG] Verifying checksums${LOG_RESET}"
|
||||
|
||||
if [[ "$actual_checksum" != "$checksum" ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR] Checksums are not matched!${LOG_NORMAL} Try to remove '$FILENAME' and exec this script again${LOG_RESET}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${LOG_SUCCESS}[LOG] Done${LOG_RESET}"
|
||||
fi
|
||||
case "$answer" in
|
||||
[Yy]es|y)
|
||||
if rm -rf "${1:?}"; then
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Deleted old installation."
|
||||
break
|
||||
else
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Something went wrong."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
[Nn]o|n)
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Exiting."
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} Invalid input!"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
install_ps() {
|
||||
echo -e "${LOG_NORMAL}[LOG] Extracting Photoshop${LOG_RESET}"
|
||||
tar -xf "./$FILENAME"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing Photoshop${LOG_RESET}"
|
||||
mv "Adobe Photoshop 2021" "$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021"
|
||||
setup_wine() {
|
||||
export WINEPREFIX="$INSTALL_PATH"
|
||||
local vc_libraries=("vcrun2003" "vcrun2005" "vcrun2010" "vcrun2012" "vcrun2013" "vcrun2022")
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Setting up wine prefix."
|
||||
winecfg /v win10 2> /dev/null
|
||||
|
||||
# echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Executing winetricks. All winetricks logs are saved in ${LOG_WARNING}./winetricks.log${LOG_RESET}."
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Executing winetricks."
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} 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
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Winetricks terminated with an error."
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Please open an issue by mentioning the contents of ${LOG_WARNING}./install_log.log${LOG_RESET}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "---------------------------------------------------------------------" >> ./install_log.log
|
||||
echo " Downloading Visual C++ Libraries " >> ./install_log.log
|
||||
echo "---------------------------------------------------------------------" >> ./install_log.log
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Downloading and installing Visual C++ libraries."
|
||||
if ! winetricks --unattended "${vc_libraries[@]}" &>> ./install_log.log; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Winetricks terminated with an error. Please, refer to ${LOG_WARNING}install_log.log${LOG_RESET} for more info."
|
||||
# echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Please open an issue by mentioning the contents of ${LOG_WARNING}./install_log.log${LOG_RESET}."
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} If you can't solve the issue yourself, please, open an issue on the GitHub."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_icon() {
|
||||
if [ -d "/usr/share/icons/Papirus" ]; then
|
||||
DESKTOP_ENTRY_ICON_NAME="photoshop"
|
||||
elif [ -d "$XDG_DATA_HOME/icons/Papirus" ]; then
|
||||
DESKTOP_ENTRY_ICON_NAME="photoshop"
|
||||
else
|
||||
DESKTOP_ENTRY_ICON_NAME="$XDG_DATA_HOME/icons/photoshop.png"
|
||||
ICON_URL="https://cdn3d.iconscout.com/3d/premium/thumb/adobe-photoshop-file-3d-icon-download-in-png-blend-fbx-gltf-formats--logo-format-graphic-design-pack-development-icons-9831950.png"
|
||||
curl -s "$ICON_URL" -o "${TEMP_DIR}/icon.webp"
|
||||
magick "${TEMP_DIR}/icon.webp" "${TEMP_DIR}/icon.png"
|
||||
download_photoshop() {
|
||||
local archive_name="Photoshop.tar.xz"
|
||||
|
||||
[ ! -d "$XDG_DATA_HOME/icons" ] && mkdir "$XDG_DATA_HOME/icons"
|
||||
mv ${TEMP_DIR}/icon.png "$XDG_DATA_HOME/icons/photoshop.png"
|
||||
if [ -f "$archive_name" ]; then
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Found existing archive."
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Comparing checksums."
|
||||
local local_checksum
|
||||
local_checksum="$(sha256sum "$archive_name" | awk '{print $1}')"
|
||||
|
||||
if [[ "$CHECKSUM" != "$local_checksum" ]]; then
|
||||
echo -e "${LOG_WARNING}[WARNING]${LOG_RESET} Checksums don't match!"
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Deleting corrupted archive."
|
||||
rm -v "${archive_name:?}" &>> ./install_log.log
|
||||
fi
|
||||
|
||||
return 0
|
||||
fi
|
||||
# echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Downloading Photoshop (1.1G). Using ${LOG_WARNING}curl${LOG_RESET} as backend. Logs are available in ${LOG_WARNING}./curl.log${LOG_RESET}."
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Downloading Photoshop (1.1G)."
|
||||
if ! curl "$PHOTOSHOP_URL" -o "$archive_name" &>> ./install_log.log; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} An error occurred during the download. Please, refer to ${LOG_WARNING}install_log.log${LOG_RESET} for more info."
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} If you can't solve the issue yourself, please, open an issue on the GitHub."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Photoshop Downloaded."
|
||||
|
||||
# TODO:
|
||||
# A separate function so you don't have to write this code multiple times
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Comparing checksums."
|
||||
local local_checksum
|
||||
local_checksum="$(sha256sum "$archive_name" | awk '{print $1}')"
|
||||
|
||||
if [[ "$CHECKSUM" != "$local_checksum" ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Checksums don't match!"
|
||||
exit 1
|
||||
|
||||
# TODO
|
||||
# while true; do
|
||||
# read -p "$(echo -e "$LOG_WARNING")[WARNING]$(echo -e "$LOG_RESET") Do you want to redownload it again? (yes/no): " answer
|
||||
# case "$answer" in
|
||||
# pattern)
|
||||
# command ...
|
||||
# ;;
|
||||
# *)
|
||||
# command ...
|
||||
# ;;
|
||||
# esac
|
||||
# done
|
||||
fi
|
||||
}
|
||||
|
||||
verify_path() {
|
||||
local path="$1"
|
||||
|
||||
# Check the validity of the path if the user has specified the absolute path manually. This is necessary in case the user accidentally misspells $HOME paths.
|
||||
# https://github.com/shvedes/photoshop-linux/issues/1
|
||||
if [[ ! "$path" =~ $HOME ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Cannot validade ${LOG_WARNING}\$HOME${LOG_RESET} path."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fix trailing slashes if needed
|
||||
path="$(echo "$path" | sed 's/\/\+$//')"
|
||||
INSTALL_PATH="$path"
|
||||
|
||||
# Remove the last folder from the given path (as it will be created by wineprefix) and check the remaining path for validity.
|
||||
local reformatted_path="$(echo "$path" | sed 's/\/[^\/]*$//')"
|
||||
|
||||
if [ -d "$reformatted_path" ]; then
|
||||
if [[ "$reformatted_path" == "$HOME" ]]; then
|
||||
return 0
|
||||
else
|
||||
echo -e "${LOG_SUCCESS}[CHECK]${LOG_RESET} Directory $reformatted_path exist."
|
||||
fi
|
||||
else
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Path $reformatted_path does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# TODO:
|
||||
# Do not use the same checks multiple times
|
||||
install_photoshop() {
|
||||
if [ -z "$LOCAL_ARCHIVE" ]; then
|
||||
# echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing Photoshop."
|
||||
local filename="Photoshop.tar.xz"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Extracting Photoshop."
|
||||
if ! tar xvf "$filename" &>> ./install_log.log; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} An error occurred while unpacking the archive."
|
||||
exit 1
|
||||
# TODO:
|
||||
# A separate function so you don't have to write this code multiple times
|
||||
# while true; do
|
||||
# read -p "Delete wine prefix?"
|
||||
# command ...
|
||||
# done
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing Photoshop."
|
||||
if ! mv "./Adobe Photoshop 2021" "$INSTALL_PATH/drive_c/Program Files"; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} An error occurred during installation."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Using local Photoshop archive."
|
||||
|
||||
if [[ ! "$LOCAL_ARCHIVE" = *.tar.xz ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Only tar.xz is accepted for now."
|
||||
exit 1
|
||||
# TODO:
|
||||
# Allow user to use not only tar.xz / archive from another sources
|
||||
fi
|
||||
|
||||
# TODO:
|
||||
# A separate function so you don't have to write this code multiple times
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Comparing checksums."
|
||||
|
||||
local local_checksum="$(sha256sum "$LOCAL_ARCHIVE" | awk '{print $1}')"
|
||||
|
||||
# TODO:
|
||||
# Allow user to skip checksum comparing
|
||||
if [[ "$CHECKSUM" != "$local_checksum" ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Checksums don't match!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Extracting Photoshop."
|
||||
if ! tar xvf "$LOCAL_ARCHIVE" &>> ./install_log.log; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} An error occurred while unpacking the archive."
|
||||
exit 1
|
||||
# TODO:
|
||||
# A separate function so you don't have to write this code multiple times
|
||||
# while true; do
|
||||
# read -p "Delete wine prefix?"
|
||||
# command ...
|
||||
# done
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing Photoshop."
|
||||
if ! mv "./Adobe Photoshop 2021" "$INSTALL_PATH/drive_c/Program Files"; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} An error occurred during installation. Please, refer to ${LOG_WARNING}install_log.log${LOG_RESET} for more info."
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} If you can't solve the issue yourself, please, open an issue on the GitHub."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_icon() {
|
||||
# Papirus Icon Theme already has a Photoshop icon in it.
|
||||
# The script will check if you have Papirus installed and use its icon. If Papirus is not installed, the script will download the icon from the Internet and use it.
|
||||
if find /usr/share/icons -name "Papirus*" &> /dev/null; then
|
||||
ICON="photoshop"
|
||||
else
|
||||
if [ -d "$XDG_DATA_HOME/icons" ]; then
|
||||
if find "$XDG_DATA_HOME/icons" -name "Papirus*" &> /dev/null; then
|
||||
ICON="photoshop"
|
||||
fi
|
||||
else
|
||||
mkdir "$XDG_DATA_HOME/icons"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$ICON" ]; then
|
||||
local icon_url="https://cdn3d.iconscout.com/3d/premium/thumb/adobe-photoshop-file-3d-icon-download-in-png-blend-fbx-gltf-formats--logo-format-graphic-design-pack-development-icons-9831950.png"
|
||||
if ! curl "$icon_url" -o "icon.webp" &>> ./install_log.log; then
|
||||
echo -e "${LOG_ERROR}[ERROR]${LOG_RESET} Failed to download icon. Please refer ${LOG_WARNING}install_log.log${LOG_RESET} for info."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
magick "icon.webp" "icon.png"
|
||||
rm "./icon.webp"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing icon for .desktop entry."
|
||||
mv "./icon.png" "$XDG_DATA_HOME/icons/photoshop.png"
|
||||
ICON="$XDG_DATA_HOME/icons/photoshop.png"
|
||||
fi
|
||||
}
|
||||
|
||||
install_desktop_entry() {
|
||||
if [ ! -d "$XDG_DATA_HOME/applications" ]; then
|
||||
mkdir "$XDG_DATA_HOME/applications"
|
||||
fi
|
||||
|
||||
local path="$XDG_DATA_HOME/applications/photoshop.desktop"
|
||||
|
||||
echo "[Desktop Entry]" > "$path"
|
||||
echo "Name=Adobe Photoshop CC 2021" >> "$path"
|
||||
echo "Exec=bash -c "$WINEPREFIX/drive_c/launcher.sh %F"" >> "$path"
|
||||
echo "Type=Application" >> "$path"
|
||||
echo "Comment=The industry-standard photo editing software (Wine)" >> "$path"
|
||||
echo "Categories=Graphics" >> "$path"
|
||||
echo "Icon=$DESKTOP_ENTRY_ICON_NAME" >> "$path"
|
||||
echo "MimeType=image/psd;image/x-psd;image/png;image/jpg;image/jpeg;image/webp;image/heif;image/raw" >> "$path"
|
||||
echo "StartupWMClass=photoshop.exe" >> "$path"
|
||||
echo "[Desktop Entry]" > "$path"
|
||||
echo "Name=Adobe Photoshop CC 2021" >> "$path"
|
||||
echo "Exec=bash -c "$HOME/.local/bin/photoshop.sh %F"" >> "$path"
|
||||
echo "Type=Application" >> "$path"
|
||||
echo "Comment=The industry-standard photo editing software (Wine" >> "$path"
|
||||
echo "Categories=Graphics" >> "$path"
|
||||
echo "Icon=$ICON" >> "$path"
|
||||
echo "MimeType=image/psd;image/x-psd;image/png;image/jpg;image/jpeg;image/webp;image/heif;image/raw" >> "$path"
|
||||
echo "StartupWMClass=photoshop.exe" >> "$path"
|
||||
}
|
||||
|
||||
install_launcher() {
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing launcher${LOG_RESET}"
|
||||
|
||||
local path="$WINEPREFIX/drive_c/launcher.sh"
|
||||
|
||||
echo "#!/usr/bin/env bash" > "$path"
|
||||
echo " " >> "$path"
|
||||
echo "WINEPREFIX=\"$WINEPREFIX\"" >> "$path"
|
||||
echo "DXVK_LOG_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$path"
|
||||
echo "DXVK_STATE_CACHE_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$path"
|
||||
echo "PHOTOSHOP=\"\$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021/photoshop.exe\"" >> "$path"
|
||||
echo " " >> "$path"
|
||||
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" " >> "$path"
|
||||
|
||||
chmod +x "$path"
|
||||
}
|
||||
|
||||
checks() {
|
||||
if [ -z "$1" ]; then
|
||||
echo -e "${LOG_NORMAL}Usage: ./install.sh <absolute path>${LOG_RESET}"
|
||||
exit 0
|
||||
else
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${LOG_ERROR}Install path alrady exists${LOG_RESET}"
|
||||
read -p "$(tput setaf 3)Do you want to remove it? (y/n) $(tput sgr0)" answer
|
||||
|
||||
case "$answer" in
|
||||
y)
|
||||
rm -rf "$WINEPREFIX"
|
||||
;;
|
||||
n)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if [[ "$1" != /* ]]; then
|
||||
echo -e "${LOG_NORMAL}You need to specify absolute path, not relative${LOG_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if [ ! -d "$HOME/.local/bin" ]; then
|
||||
mkdir "$HOME/.local/bin"
|
||||
fi
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG]${LOG_RESET} Installing launcher."
|
||||
|
||||
echo "#!/usr/bin/env bash" > "$LAUNCHER"
|
||||
echo " " >> "$LAUNCHER"
|
||||
echo "WINEPREFIX=\"$WINEPREFIX\"" >> "$LAUNCHER"
|
||||
echo "DXVK_LOG_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$LAUNCHER"
|
||||
echo "DXVK_STATE_CACHE_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$LAUNCHER"
|
||||
echo "PHOTOSHOP=\"\$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021/photoshop.exe\"" >> "$LAUNCHER"
|
||||
echo " " >> "$LAUNCHER"
|
||||
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" " >> "$LAUNCHER"
|
||||
|
||||
chmod +x "$LAUNCHER"
|
||||
}
|
||||
|
||||
checks "$1"
|
||||
check_dependencies
|
||||
setup_wine
|
||||
download_ps
|
||||
install_ps
|
||||
install_icon
|
||||
install_desktop_entry
|
||||
install_launcher
|
||||
main() {
|
||||
if ! check_deps; then
|
||||
install_deps
|
||||
fi
|
||||
|
||||
echo -e "${LOG_SUCCESS}[LOG] Photoshop successfully installed${LOG_RESET}"
|
||||
verify_path "$INSTALL_PATH"
|
||||
is_path_exists "$INSTALL_PATH"
|
||||
setup_wine
|
||||
|
||||
if [ -z "$LOCAL_ARCHIVE" ]; then
|
||||
download_photoshop
|
||||
install_photoshop
|
||||
else
|
||||
install_photoshop
|
||||
fi
|
||||
|
||||
install_icon
|
||||
install_desktop_entry
|
||||
install_launcher
|
||||
|
||||
echo -e "${LOG_SUCCESS}[SUCCESS]${LOG_RESET} Photoshop is successfully installed."
|
||||
}
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
get_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while getopts "a:i:h" flag; do
|
||||
case $flag in
|
||||
a)
|
||||
LOCAL_ARCHIVE="$OPTARG"
|
||||
;;
|
||||
h)
|
||||
get_help
|
||||
;;
|
||||
i)
|
||||
INSTALL_PATH="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG Use -h for help."
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
|
267
install.sh.old
Executable file
267
install.sh.old
Executable file
@ -0,0 +1,267 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Adapted script from LinSoftWin/Photoshop-CC2022-Linux
|
||||
|
||||
export WINEPREFIX="$1"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
|
||||
LOG_NORMAL="\e[1;97m"
|
||||
LOG_ERROR="\e[1;31m"
|
||||
LOG_SUCCESS="\e[1;32m"
|
||||
LOG_RESET="\e[0m"
|
||||
|
||||
TEMP_DIR="$(mktemp -d)"
|
||||
FILENAME="Photoshop.tar.xz"
|
||||
|
||||
trap 'on_error ${LINENO} "$BASH_COMMAND"' ERR
|
||||
trap on_interrupt SIGINT
|
||||
|
||||
on_interrupt() {
|
||||
echo -e "\n${LOG_NORMAL}User intrrupt! Cleaning up..${LOG_RESET}"
|
||||
|
||||
if [ -f "./$FILENAME" ]; then
|
||||
rm "$FILENAME"
|
||||
elif [ -d "./Adobe Photoshop 2021" ]; then
|
||||
rm -rf "./Adobe Photoshop 2021"
|
||||
fi
|
||||
|
||||
[ -d "$WINEPREFIX" ] && rm -rf "$WINEPREFIX"
|
||||
rm -rf "$TEMP_DIR"
|
||||
exit 0
|
||||
}
|
||||
|
||||
on_error() {
|
||||
local lineno="$1"
|
||||
local command="$2"
|
||||
echo -e "${LOG_ERROR}[LOG] error in the line ${lineno}${LOG_RESET}: command '$command'"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_dependencies() {
|
||||
declare -A packages=(
|
||||
["curl"]="curl"
|
||||
["wine"]="wine"
|
||||
["winetricks"]="winetricks"
|
||||
["magick"]="imagemagick"
|
||||
)
|
||||
|
||||
local missed_packages=()
|
||||
|
||||
for bin in "${!packages[@]}"; do
|
||||
if ! command -v "$bin" > /dev/null; then
|
||||
missed_packages+=("${packages[$bin]}")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#missed_packages[@]} -eq 0 ]; then
|
||||
echo -e "${LOG_SUCCESS}[LOG] All dependencies are installed${LOG_RESET}" && sleep 1
|
||||
else
|
||||
echo -e "${LOG_ERROR}Missing dependencies:${LOG_NORMAL} ${missed_packages[@]}${LOG_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
setup_wine() {
|
||||
|
||||
mkdir "$WINEPREFIX"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Folder $WINEPREFIX created${LOG_RESET}"
|
||||
echo -e "${LOG_NORMAL}[LOG] Initializing wine and setting up winetricks.. It may take some time${LOG_RESET}"
|
||||
|
||||
wineboot &> /dev/null
|
||||
winetricks fontsmooth=rgb win10 gdiplus msxml3 msxml6 atmlib corefonts dxvk win10 vkd3d d3d12 vkd3d &> /dev/null
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Downloading Visual C++ runtime...${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x64
|
||||
curl -s "https://aka.ms/vs/17/release/vc_redist.x64.exe" -o "${TEMP_DIR}/vc_redist_2015_2022_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2015_2022_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x86
|
||||
curl -s "https://aka.ms/vs/17/release/vc_redist.x86.exe" -o "${TEMP_DIR}/vc_redist_2015_2022_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2015_2022_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x64
|
||||
curl -sL "https://aka.ms/highdpimfc2013x64enu" -o "${TEMP_DIR}/vc_redist_2013_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2013_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x86
|
||||
curl -sL "https://aka.ms/highdpimfc2013x86enu" -o "${TEMP_DIR}/vc_redist_2013_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2013_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x64
|
||||
curl -s "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe" -o "${TEMP_DIR}/vc_redist_2012_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2012_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x86
|
||||
curl -s "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe" -o "${TEMP_DIR}/vc_redist_2012_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2012_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x64
|
||||
curl -s "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x64.exe" -o "${TEMP_DIR}/vc_redist_2010_x64.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2010_x64.exe${LOG_RESET}"
|
||||
# 2010 x86
|
||||
curl -s "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe" -o "${TEMP_DIR}/vc_redist_2010_x86.exe"
|
||||
echo -e " ${LOG_SUCCESS}Downloaded vc_redist_2010_x86.exe${LOG_RESET}"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing Visual C++...${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2015_2022_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2015_2022_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2015-2022 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2015_2022_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2015_2022_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2013_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2013_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2013 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2013_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2013_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2012_x64.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2012_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2012 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2012_x86.exe" /install /quiet /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2012_x86.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x64
|
||||
wine "${TEMP_DIR}/vc_redist_2010_x64.exe" /q /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2010_x64.exe${LOG_RESET}"
|
||||
|
||||
# 2010 x86
|
||||
wine "${TEMP_DIR}/vc_redist_2010_x86.exe" /q /norestart &> /dev/null
|
||||
echo -e " ${LOG_SUCCESS}Installed vc_redist_2010_x86.exe${LOG_RESET}"
|
||||
|
||||
winecfg -v win10 &> /dev/null
|
||||
}
|
||||
|
||||
download_ps() {
|
||||
local url="https://spyderrock.com/kMnq2220-AdobePhotoshop2021.xz"
|
||||
# https://github.com/LinSoftWin/Photoshop-CC2022-Linux
|
||||
local checksum="8321b969161f2d2ad736067320d493c5b6ae579eaab9400cd1fda6871af2c033"
|
||||
|
||||
if [ -f "./$FILENAME" ]; then
|
||||
echo -e "${LOG_NORMAL}[LOG] Found existing archive. Comparing checksums${LOG_RESET}"
|
||||
local actual_checksum="$(sha256sum $FILENAME | awk '{print $1}')"
|
||||
|
||||
if [ "$actual_checksum" != "$checksum" ]; then
|
||||
echo -e "${LOG_ERROR}[LOG] Corrupted archive!${LOG_NORMAL} Redownloading (1.1G)${LOG_RESET}"
|
||||
rm "./$FILENAME"
|
||||
curl -s "$url" -o "$FILENAME"
|
||||
else
|
||||
echo -e "${LOG_SUCCESS}[LOG] Done${LOG_SUCCESS}"
|
||||
fi
|
||||
else
|
||||
echo -e "${LOG_NORMAL}[LOG] Downloading Photoshop (1.1G)${LOG_RESET}"
|
||||
curl -s "$url" -o "$FILENAME"
|
||||
echo -e "${LOG_SUCCESS}[LOG] Downloaded Photoshop${LOG_RESET}"
|
||||
|
||||
actual_checksum="$(sha256sum $FILENAME | awk '{print $1}')"
|
||||
echo -e "${LOG_NORMAL}[LOG] Verifying checksums${LOG_RESET}"
|
||||
|
||||
if [[ "$actual_checksum" != "$checksum" ]]; then
|
||||
echo -e "${LOG_ERROR}[ERROR] Checksums are not matched!${LOG_NORMAL} Try to remove '$FILENAME' and exec this script again${LOG_RESET}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "${LOG_SUCCESS}[LOG] Done${LOG_RESET}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_ps() {
|
||||
echo -e "${LOG_NORMAL}[LOG] Extracting Photoshop${LOG_RESET}"
|
||||
tar -xf "./$FILENAME"
|
||||
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing Photoshop${LOG_RESET}"
|
||||
mv "Adobe Photoshop 2021" "$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021"
|
||||
}
|
||||
|
||||
install_icon() {
|
||||
if [ -d "/usr/share/icons/Papirus" ]; then
|
||||
DESKTOP_ENTRY_ICON_NAME="photoshop"
|
||||
elif [ -d "$XDG_DATA_HOME/icons/Papirus" ]; then
|
||||
DESKTOP_ENTRY_ICON_NAME="photoshop"
|
||||
else
|
||||
DESKTOP_ENTRY_ICON_NAME="$XDG_DATA_HOME/icons/photoshop.png"
|
||||
ICON_URL="https://cdn3d.iconscout.com/3d/premium/thumb/adobe-photoshop-file-3d-icon-download-in-png-blend-fbx-gltf-formats--logo-format-graphic-design-pack-development-icons-9831950.png"
|
||||
curl -s "$ICON_URL" -o "${TEMP_DIR}/icon.webp"
|
||||
magick "${TEMP_DIR}/icon.webp" "${TEMP_DIR}/icon.png"
|
||||
|
||||
[ ! -d "$XDG_DATA_HOME/icons" ] && mkdir "$XDG_DATA_HOME/icons"
|
||||
mv ${TEMP_DIR}/icon.png "$XDG_DATA_HOME/icons/photoshop.png"
|
||||
fi
|
||||
}
|
||||
|
||||
install_desktop_entry() {
|
||||
local path="$XDG_DATA_HOME/applications/photoshop.desktop"
|
||||
|
||||
echo "[Desktop Entry]" > "$path"
|
||||
echo "Name=Adobe Photoshop CC 2021" >> "$path"
|
||||
echo "Exec=bash -c "$WINEPREFIX/drive_c/launcher.sh %F"" >> "$path"
|
||||
echo "Type=Application" >> "$path"
|
||||
echo "Comment=The industry-standard photo editing software (Wine)" >> "$path"
|
||||
echo "Categories=Graphics" >> "$path"
|
||||
echo "Icon=$DESKTOP_ENTRY_ICON_NAME" >> "$path"
|
||||
echo "MimeType=image/psd;image/x-psd;image/png;image/jpg;image/jpeg;image/webp;image/heif;image/raw" >> "$path"
|
||||
echo "StartupWMClass=photoshop.exe" >> "$path"
|
||||
}
|
||||
|
||||
install_launcher() {
|
||||
echo -e "${LOG_NORMAL}[LOG] Installing launcher${LOG_RESET}"
|
||||
|
||||
local path="$WINEPREFIX/drive_c/launcher.sh"
|
||||
|
||||
echo "#!/usr/bin/env bash" > "$path"
|
||||
echo " " >> "$path"
|
||||
echo "WINEPREFIX=\"$WINEPREFIX\"" >> "$path"
|
||||
echo "DXVK_LOG_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$path"
|
||||
echo "DXVK_STATE_CACHE_PATH=\"\$WINEPREFIX/dxvk_cache\"" >> "$path"
|
||||
echo "PHOTOSHOP=\"\$WINEPREFIX/drive_c/Program Files/Adobe Photoshop 2021/photoshop.exe\"" >> "$path"
|
||||
echo " " >> "$path"
|
||||
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" " >> "$path"
|
||||
|
||||
chmod +x "$path"
|
||||
}
|
||||
|
||||
checks() {
|
||||
if [ -z "$1" ]; then
|
||||
echo -e "${LOG_NORMAL}Usage: ./install.sh <absolute path>${LOG_RESET}"
|
||||
exit 0
|
||||
else
|
||||
if [ -d "$1" ]; then
|
||||
echo -e "${LOG_ERROR}Install path alrady exists${LOG_RESET}"
|
||||
read -p "$(tput setaf 3)Do you want to remove it? (y/n) $(tput sgr0)" answer
|
||||
|
||||
case "$answer" in
|
||||
y)
|
||||
rm -rf "$WINEPREFIX"
|
||||
;;
|
||||
n)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
if [[ "$1" != /* ]]; then
|
||||
echo -e "${LOG_NORMAL}You need to specify absolute path, not relative${LOG_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
checks "$1"
|
||||
check_dependencies
|
||||
setup_wine
|
||||
download_ps
|
||||
install_ps
|
||||
install_icon
|
||||
install_desktop_entry
|
||||
install_launcher
|
||||
|
||||
echo -e "${LOG_SUCCESS}[LOG] Photoshop successfully installed${LOG_RESET}"
|
Loading…
x
Reference in New Issue
Block a user