1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cyberchef_ynh.git synced 2024-09-03 18:16:31 +02:00

set source to zip filename to prevent a broken install due to an upstream mismatch between release name and actual filenames

This commit is contained in:
oleole39 2024-02-19 15:52:48 +01:00
parent dfd5b60ba9
commit b83bf47d88
2 changed files with 8 additions and 14 deletions

View file

@ -9,8 +9,9 @@
source _common.sh
source /usr/share/yunohost/helpers
upstream_version=$(ynh_app_upstream_version)
index_page="CyberChef_v${upstream_version}.html"
upstream_source_url=$(ynh_read_manifest --manifest_key="resources.sources.main.url")
source_filename=$(basename $upstream_source_url)
index_page=$(basename -s .zip $upstream_source_url).html #this variable will also populate the template tag __INDEX_PAGE__ in nginx.conf
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
@ -19,12 +20,8 @@ index_page="CyberChef_v${upstream_version}.html"
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=10
sources_json=$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq ".resources.sources[\"main\"]")
upstream_source_url=$(echo $sources_json | jq -r .url)
source_filename=$(basename $upstream_source_url)
index_html_page=$(basename -s .zip $upstream_source_url).html
ynh_setup_source --dest_dir="$install_dir"
sed -i "s|$source_filename|$upstream_source_url|g" "$install_dir/$index_html_page" #replace local link to source file with upstream source file's link
sed -i "s|$source_filename|$upstream_source_url|g" "$install_dir/$index_page" #replace local link to source file with upstream source file's link
chown -R $app:www-data "$install_dir"
#=================================================

View file

@ -11,8 +11,9 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
upstream_version=$(ynh_app_upstream_version)
index_page="CyberChef_v${upstream_version}.html"
upstream_source_url=$(ynh_read_manifest --manifest_key="resources.sources.main.url")
source_filename=$(basename $upstream_source_url)
index_page=$(basename -s .zip $upstream_source_url).html #this variable will also populate the template tag __INDEX_PAGE__ in nginx.conf
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD, ETC...)
@ -23,12 +24,8 @@ index_page="CyberChef_v${upstream_version}.html"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=10
sources_json=$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq ".resources.sources[\"main\"]")
upstream_source_url=$(echo $sources_json | jq -r .url)
source_filename=$(basename $upstream_source_url)
index_html_page=$(basename -s .zip $upstream_source_url).html
ynh_setup_source --dest_dir="$install_dir"
sed -i "s|$source_filename|$upstream_source_url|g" "$install_dir/$index_html_page" #replace local link to source file with upstream source file's link
sed -i "s|$source_filename|$upstream_source_url|g" "$install_dir/$index_page" #replace local link to source file with upstream source file's link
chown -R $app:www-data "$install_dir"
fi