Compare commits

...

2 Commits

Author SHA1 Message Date
shvedes
0f9bd53282 cleanup 2025-02-24 02:06:26 +01:00
shvedes
9217d9aea9 ⚒ getopts: check only getopts options 2025-02-24 01:50:59 +01:00
3 changed files with 27 additions and 17 deletions

5
.gitignore vendored
View File

@ -1,5 +0,0 @@
uninstall.sh
install.sh.bak
install_log.log
test.sh
*.tar*

View File

@ -7,19 +7,18 @@ By providing this software, I do not give any guarantees of its work. This scrip
## Showcase ## Showcase
![image](https://github.com/user-attachments/assets/5f4edc77-a67e-49c5-8332-b436f1d6134d) ![image](https://github.com/user-attachments/assets/5f4edc77-a67e-49c5-8332-b436f1d6134d)
![image](https://github.com/user-attachments/assets/ad8c7477-4682-4edc-8665-4f5b5380a382)
### What works ### What works
- Drag and drop (doesn't work on Hyprland) - Drag and drop ~~(doesn't work on Hyprland)~~ (should be fixed with recent update. Not tested)
- Clipboard image pasting - Clipboard image pasting
- Mime type association (right click menu, see [here](https://github.com/user-attachments/assets/eb5f7ab3-fb75-47e7-841b-a763ca5e3382)) - Mime type association (right click menu, see [here](https://github.com/user-attachments/assets/eb5f7ab3-fb75-47e7-841b-a763ca5e3382))
- GPU acceleration - GPU acceleration (no warranty to work)
**Tested on:** **Tested on:**
- Arch Linux / CachyOS - Arch Linux / CachyOS
- KDE Plasma 6.2 (Wayland) / Hyprland - KDE Plasma 6.2 (Wayland) / Hyprland
- wine 9.19+ / wine-staging 9.20+ / wine-cachyos 9.20+ - wine 9.19+ / wine-staging 9.20+ / ~~wine-cachyos 9.20+~~ window freezes
- AMD GPU - AMD GPU
### Known issues ### Known issues
@ -34,7 +33,7 @@ By providing this software, I do not give any guarantees of its work. This scrip
## Usage ## Usage
```bash ```bash
./install.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

View File

@ -15,6 +15,7 @@ XDG_DATA_HOME="$HOME/.local/share"
if [ ! -d "$XDG_CACHE_HOME" ]; then if [ ! -d "$XDG_CACHE_HOME" ]; then
XDG_CACHE_HOME="$HOME/.cache" XDG_CACHE_HOME="$HOME/.cache"
fi fi
# LOGGING SYSTEM # LOGGING SYSTEM
# ##################################################################### # #####################################################################
# #
@ -40,6 +41,7 @@ if [ -z "$XDG_DATA_HOME" ] && [ -z "$XDG_CACHE_HOME" ]; then
fi fi
# Photoshop URL # Photoshop URL
# TODO: change hosting server
PHOTOSHOP_URL="https://spyderrock.com/kMnq2220-AdobePhotoshop2021.xz" PHOTOSHOP_URL="https://spyderrock.com/kMnq2220-AdobePhotoshop2021.xz"
# sha256 checksum # sha256 checksum
@ -103,9 +105,11 @@ ask_user() {
# 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. # 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() { check_deps() {
declare -A packages=( declare -A packages=(
["curl"]="curl" ["curl"]="curl" # Usually pre-installed on most distributions
["wine"]="wine" ["wine"]="wine"
["winetricks"]="winetricks" ["winetricks"]="winetricks"
# TODO: do not install ImageMagick if the user is using Papirus.
["magick"]="imagemagick" ["magick"]="imagemagick"
) )
@ -133,6 +137,7 @@ install_deps() {
source /etc/os-release source /etc/os-release
# Deprecated. Will not be updated. Still works for listed distros
# Refer to /etc/os-release for more info # Refer to /etc/os-release for more info
case "$ID" in case "$ID" in
"arch"|"cachyos") "arch"|"cachyos")
@ -424,6 +429,7 @@ install_launcher() {
echo -e "$LOG Installing launcher." echo -e "$LOG Installing launcher."
# Thanks to Katy248 (https://github.com/Katy248) for the idea. # Thanks to Katy248 (https://github.com/Katy248) for the idea.
# Note: some variables are not used at all; TODO: remove them
{ {
echo "#!/usr/bin/env bash" echo "#!/usr/bin/env bash"
echo "" echo ""
@ -463,13 +469,19 @@ main() {
echo -e "$SUCCES Photoshop is successfully installed." echo -e "$SUCCES Photoshop is successfully installed."
} }
if [[ $# -eq 0 ]]; then if [[ -n $1 && $1 != -* ]]; then
echo "Invalid input: options must start with '-'"
get_help get_help
exit 0 exit 1
fi fi
while getopts "a:i:h" flag; do if [ -z "$1" ]; then
case $flag in get_help
exit 1
fi
while getopts "a:i:h" opt; do
case "$opt" in
a) a)
LOCAL_ARCHIVE="$OPTARG" LOCAL_ARCHIVE="$OPTARG"
;; ;;
@ -479,7 +491,11 @@ while getopts "a:i:h" flag; do
i) i)
INSTALL_PATH="$OPTARG" INSTALL_PATH="$OPTARG"
;; ;;
\?) :)
echo "Option -${OPTARG} requires an argument"
exit 1
;;
?)
echo "Invalid option: -$OPTARG Use -h for help." echo "Invalid option: -$OPTARG Use -h for help."
exit 1 exit 1
;; ;;