2021-02-21 06:08:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
2023-07-12 10:40:28 +02:00
|
|
|
PICTRS_VERSION=0.4.1-rc.0
|
2021-02-21 06:08:46 +01:00
|
|
|
|
2023-07-11 08:03:10 +02:00
|
|
|
NODEJS_VERSION=20
|
2021-02-21 06:08:46 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2023-08-08 20:55:58 +02:00
|
|
|
# Downloads an AppImage from an url, unpacks and extracts it in a destination directory, and creates a symlink to its executable
|
|
|
|
download_and_install_appimage() {
|
|
|
|
|
|
|
|
# Declare an array to define the options of this helper.
|
|
|
|
local legacy_args=nud
|
|
|
|
local -A args_array=([n]=name= [u]=url= [d]=directory= [s]=symlink=)
|
|
|
|
local url
|
|
|
|
local directory
|
|
|
|
local name
|
|
|
|
# Manage arguments with getopts
|
|
|
|
ynh_handle_getopts_args "$@"
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
ynh_secure_remove --file="$install_dir/pict-rs/$name"
|
|
|
|
ynh_secure_remove --file="$install_dir/pict-rs/$name.appimage"
|
|
|
|
ynh_secure_remove --file="$install_dir/pict-rs/$name.appimageextract"
|
|
|
|
|
|
|
|
# Download and make executable
|
|
|
|
curl -f "$url" -o "$directory/$name.appimage" -s
|
|
|
|
[ ! -f "$directory/$name.appimage" ] && ynh_print_err --message="AppImage could not be downloaded"
|
|
|
|
chmod +x "$directory/$name.appimage"
|
|
|
|
|
|
|
|
# Extract and create link
|
|
|
|
pushd "$directory"
|
|
|
|
"$directory/$name.appimage" --appimage-extract
|
|
|
|
mv "$directory/squashfs-root" "$directory/$name.appimageextract"
|
|
|
|
ln -s "$directory/$name.appimageextract/AppRun" "$directory/$name"
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
2021-02-21 06:08:46 +01:00
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|