Remove dependency checking and added RED OS dependencies

This commit is contained in:
Katy248 2024-10-16 12:45:26 +03:00
parent 663592acd1
commit 9f551a2784

View File

@ -108,7 +108,7 @@ print_warn() {
# Not used yet # Not used yet
ask_user() { ask_user() {
local message=$1 local message=$1
echo -e "${WARNING} ${message}" print_warn "${message}"
while true; do while true; do
read -p "([Y]es/[N]o): " answer read -p "([Y]es/[N]o): " answer
@ -127,62 +127,62 @@ ask_user() {
done done
} }
# Imagemagick is needed in case you are not using Papirus Icons. export DEPENDENCIES
# 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. case "${OS_ID}" in
check_deps() { arch)
declare -A packages=( DEPENDENCIES=(
["curl"]="curl" curl
["wine"]="wine" wine
["winetricks"]="winetricks" winetricks
["magick"]="imagemagick" imagemagik
) )
;;
missed_packages=() redos)
DEPENDENCIES=(
for bin in "${!packages[@]}"; do curl
if ! command -v "$bin" >/dev/null; then wine
missed_packages+=("${packages[$bin]}") winetricks
fi ImageMagick
done zstd
)
if [ ${#missed_packages[@]} -eq 0 ]; then ;;
echo -e "$CHECK All dependencies are installed." *)
else print_error "Unsupported OS"
echo -e "$WARNING Missing dependencies: ${YELLOW}${missed_packages[*]}${RESET}." exit 1
return 1 ;;
fi esac
}
install_deps() { install_deps() {
local can_use_sudo local can_use_sudo
can_use_sudo=$(ask_user "Script will use ${RED}sudo${RESET}, do you want to continue?") can_use_sudo=$(ask_user "Script will use ${RED}sudo${RESET}, do you want to continue?")
if [[ "${can_use_sudo}" != 0 ]]; then if [[ "${can_use_sudo}" == 0 ]]; then
print_log "Exiting" print_log "Exiting..."
exit 0 exit 0
fi fi
print_log "Installing missing dependencies"
case "$OS_ID" in case "$OS_ID" in
"arch") arch)
# To display the list of packages correctly, we need to format the string. if ! sudo pacman -S "${DEPENDENCIES[@]}"; then
# 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 Installing missing dependencies"
if ! sudo pacman -S "${missed_packages[@]}"; then
print_error "Pacman terminated with an error." print_error "Pacman terminated with an error."
exit 1 exit 1
fi fi
;;
redos)
if ! sudo dnf install -y "${DEPENDENCIES[@]}" --comment "Installed from photoshop-linux script"; then
print_error "DNF terminated with an error"
exit 1
fi
;; ;;
*) *)
echo -e "$ERROR For now only ${BLUE}Arch Linux${RESET} is supported." print_error "For now only ${BLUE}Arch Linux${RESET} and ${RED}RED OS${RESET} is supported."
exit 1 exit 1
;; ;;
esac esac
echo -e "$LOG Missing dependencies was installed" print_log "Missing dependencies was installed"
} }
# MAIN SCRIPT # MAIN SCRIPT
@ -467,9 +467,7 @@ install_launcher() {
} }
main() { main() {
if ! check_deps; then install_deps
install_deps
fi
verify_path "$INSTALL_PATH" verify_path "$INSTALL_PATH"
is_path_exists "$INSTALL_PATH" is_path_exists "$INSTALL_PATH"