mirror of
https://github.com/shvedes/photoshop-linux.git
synced 2025-09-08 12:14:59 +00:00
Merge pull request #5 from MaximalCats/main
fix: use $HOME/.cache for logging
This commit is contained in:
commit
f57e314db7
58
install.sh
58
install.sh
@ -9,8 +9,10 @@
|
||||
# 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"
|
||||
XDG_CACHE_HOME="$HOME/.cache"
|
||||
|
||||
if [ ! -d "$XDG_CACHE_HOME" ]; then
|
||||
XDG_CACHE_HOME="$HOME/.cache"
|
||||
fi
|
||||
# LOGGING SYSTEM
|
||||
# #####################################################################
|
||||
#
|
||||
@ -54,7 +56,7 @@ on_interrupt() {
|
||||
|
||||
if [ -d "$INSTALL_PATH" ]; 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:?}" 2>>./install_log.log; then
|
||||
exit 0
|
||||
else
|
||||
echo -e "$ERORR The last command ended with an error."
|
||||
@ -81,15 +83,16 @@ ask_user() {
|
||||
read -r -p "$(echo -e "${WARNING} $* (yes/no): ")" answer
|
||||
|
||||
case "$answer" in
|
||||
[yY]|[yY][eE][sS])
|
||||
[yY] | [yY][eE][sS])
|
||||
return 0
|
||||
;;
|
||||
[nN]|[nN][oO])
|
||||
[nN] | [nN][oO])
|
||||
return 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid input, try again"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@ -107,7 +110,7 @@ check_deps() {
|
||||
missed_packages=()
|
||||
|
||||
for bin in "${!packages[@]}"; do
|
||||
if ! command -v "$bin" > /dev/null; then
|
||||
if ! command -v "$bin" >/dev/null; then
|
||||
missed_packages+=("${packages[$bin]}")
|
||||
fi
|
||||
done
|
||||
@ -168,7 +171,7 @@ is_path_exists() {
|
||||
echo -e "$WARNING The specified path '${YELLOW}${1}${RESET}' already exists."
|
||||
|
||||
if ask_user "Do you want to ${RED}delete${RESET} previous installation?"; then
|
||||
if rm -rfv "${1:?}" 2>> ./install_log.log; then
|
||||
if rm -rfv "${1:?}" 2>>./install_log.log; then
|
||||
echo -e "$LOG Deleted old installation."
|
||||
else
|
||||
echo -e "$ERROR Something went wrong."
|
||||
@ -186,11 +189,11 @@ setup_wine() {
|
||||
local vc_libraries=("vcrun2003" "vcrun2005" "vcrun2010" "vcrun2012" "vcrun2013" "vcrun2022")
|
||||
|
||||
echo -e "$LOG Setting up wine prefix."
|
||||
winecfg /v win10 2> /dev/null
|
||||
winecfg /v win10 2>/dev/null
|
||||
|
||||
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 Please open an issue by mentioning the contents of ${YELLOW}./install_log.log${RESET}."
|
||||
exit 1
|
||||
@ -200,10 +203,10 @@ setup_wine() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
echo " Downloading Visual C++ Libraries "
|
||||
echo "---------------------------------------------------------------------"
|
||||
} >> ./install_log.log # Thanks to Katy248 for the idea.
|
||||
} >>./install_log.log # Thanks to Katy248 for the idea.
|
||||
|
||||
echo -e "$LOG Downloading and installing Visual C++ libraries."
|
||||
if ! winetricks --unattended "${vc_libraries[@]}" &>> ./install_log.log; then
|
||||
if ! winetricks --unattended "${vc_libraries[@]}" &>>./install_log.log; then
|
||||
echo -e "$ERROR Winetricks terminated with an error. Please, refer to ${YELLOW}install_log.log${RESET} for more info."
|
||||
echo -e "$ERROR If you can't solve the issue yourself, please, open an issue on the GitHub."
|
||||
exit 1
|
||||
@ -224,7 +227,7 @@ download_photoshop() {
|
||||
if [[ "$CHECKSUM" != "$local_checksum" ]]; then
|
||||
echo -e "$LOG Checksums don't match!"
|
||||
echo -e "$LOG Deleting corrupted archive."
|
||||
rm -v "${archive_name:?}" &>> ./install_log.log
|
||||
rm -v "${archive_name:?}" &>>./install_log.log
|
||||
fi
|
||||
|
||||
return 0
|
||||
@ -302,7 +305,7 @@ install_photoshop() {
|
||||
local filename="Photoshop.tar.xz"
|
||||
|
||||
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."
|
||||
exit 1
|
||||
# TODO:
|
||||
@ -343,7 +346,7 @@ install_photoshop() {
|
||||
fi
|
||||
|
||||
echo -e "$LOG Extracting Photoshop."
|
||||
if ! tar xvf "$LOCAL_ARCHIVE" &>> ./install_log.log; then
|
||||
if ! tar xvf "$LOCAL_ARCHIVE" &>>./install_log.log; then
|
||||
echo -e "$ERROR An error occurred while unpacking the archive."
|
||||
exit 1
|
||||
# TODO:
|
||||
@ -366,11 +369,11 @@ install_photoshop() {
|
||||
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
|
||||
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
|
||||
if find "$XDG_DATA_HOME/icons" -name "Papirus*" &>/dev/null; then
|
||||
ICON="photoshop"
|
||||
fi
|
||||
else
|
||||
@ -380,7 +383,7 @@ install_icon() {
|
||||
|
||||
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
|
||||
if ! curl "$icon_url" -o "icon.webp" &>>./install_log.log; then
|
||||
echo -e "$ERROR Failed to download icon. Please refer ${YELLOW}install_log.log${RESET} for info."
|
||||
exit 1
|
||||
fi
|
||||
@ -403,15 +406,15 @@ install_desktop_entry() {
|
||||
|
||||
echo -e "$LOG Genarating application menu item."
|
||||
|
||||
echo "[Desktop Entry]" > "$path"
|
||||
echo "Name=Adobe Photoshop CC 2021" >> "$path"
|
||||
echo "Exec=bash -c "$HOME/.local/bin/photoshop/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"
|
||||
echo "[Desktop Entry]" >"$path"
|
||||
echo "Name=Adobe Photoshop CC 2021" >>"$path"
|
||||
echo "Exec=bash -c "$HOME/.local/bin/photoshop/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() {
|
||||
@ -423,14 +426,14 @@ install_launcher() {
|
||||
echo "#!/usr/bin/env bash"
|
||||
echo ""
|
||||
echo "export WINEPREFIX=\"$WINEPREFIX\""
|
||||
echo "LOG_FILE=\"\$XDG_CACHE_HOME/photoshop.log\""
|
||||
echo "LOG_FILE=\"$XDG_CACHE_HOME/photoshop.log\""
|
||||
echo "DXVK_LOG_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 ""
|
||||
echo "echo -e \"All logs are saved in \$LOG_FILE\""
|
||||
echo "wine64 \"\$PHOTOSHOP\" \"\$@\" &> \"\$LOG_FILE\" "
|
||||
} > "$LAUNCHER"
|
||||
} >"$LAUNCHER"
|
||||
|
||||
chmod +x "$LAUNCHER"
|
||||
}
|
||||
@ -477,6 +480,7 @@ while getopts "a:i:h" flag; do
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG Use -h for help."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user