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

Merge pull request #3 from YunoHost-Apps/testing

Update to version 10.4.0 & add autoupdate strategy
This commit is contained in:
oleole39 2023-04-05 05:15:45 +02:00 committed by GitHub
commit 644a1b557e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 146 deletions

View file

@ -1,137 +0,0 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"admin"*)
src="app"
;;
*"update"*)
src="app-upgrade"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A simple, intuitive web app for analysing and decoding data without having to deal with complex tools or programming languages. CyberChef encourages both technical and non-technical people to explore data formats, encryption and compression: encode, decode, format data, parse data, encrypt, decrypt, compress data, extract data, perform arithmetic functions against data, etc.. There are around 300 operations in CyberChef allowing you to carry out simple and complex tasks easily. A simple, intuitive web app for analysing and decoding data without having to deal with complex tools or programming languages. CyberChef encourages both technical and non-technical people to explore data formats, encryption and compression: encode, decode, format data, parse data, encrypt, decrypt, compress data, extract data, perform arithmetic functions against data, etc.. There are around 300 operations in CyberChef allowing you to carry out simple and complex tasks easily.
**Shipped version:** 1.0~ynh1 **Shipped version:** 10.4.0~ynh1
**Demo:** https://gchq.github.io/CyberChef **Demo:** https://gchq.github.io/CyberChef

View file

@ -19,7 +19,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Une application web simple et intuitive pour analyser et décoder des données sans avoir affaire à des outils ou des langages de programmation compliqués. CyberChef s'adresse aussi bien aux utilisateurs expérimentés qu'aux plus novices souhaitant explorer les formats de données, leur chiffrement et leur compression: encoder, décoder, formater, analyser, chiffrer, déchiffrer, compresser, extraire, fonctions arithmétiques, etc.. Il y a en tout près de 300 outils dans CyberChef permettant de réaliser facilement des tâches simples ou complexes. Une application web simple et intuitive pour analyser et décoder des données sans avoir affaire à des outils ou des langages de programmation compliqués. CyberChef s'adresse aussi bien aux utilisateurs expérimentés qu'aux plus novices souhaitant explorer les formats de données, leur chiffrement et leur compression: encoder, décoder, formater, analyser, chiffrer, déchiffrer, compresser, extraire, fonctions arithmétiques, etc.. Il y a en tout près de 300 outils dans CyberChef permettant de réaliser facilement des tâches simples ou complexes.
**Version incluse :** 1.0~ynh1 **Version incluse :** 10.4.0~ynh1
**Démo :** https://gchq.github.io/CyberChef **Démo :** https://gchq.github.io/CyberChef

View file

@ -4,7 +4,7 @@ location __PATH__/ {
# Path to source # Path to source
alias __INSTALL_DIR__/; alias __INSTALL_DIR__/;
index CyberChef_v9.55.0.html; index __INDEX_PAGE__;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;

View file

@ -4,7 +4,7 @@ id = "cyberchef"
name = "CyberChef" name = "CyberChef"
description.en = "The Cyber Swiss Army Knife - client-side toolbox for data analysis (encoding, encryption, parsing and more)." description.en = "The Cyber Swiss Army Knife - client-side toolbox for data analysis (encoding, encryption, parsing and more)."
description.fr = "Le cyber-couteau suisse - boîte à outils s'executant côté client pour l'analyse de données (encodage, chiffrage, extraction, et plus encore)." description.fr = "Le cyber-couteau suisse - boîte à outils s'executant côté client pour l'analyse de données (encodage, chiffrage, extraction, et plus encore)."
version = "1.0~ynh1" version = "10.4.0~ynh1"
maintainers = ["oleole39"] maintainers = ["oleole39"]
@ -21,9 +21,9 @@ architectures = "all"
multi_instance = true multi_instance = true
ldap = "not_relevant" ldap = "not_relevant"
sso = "not_relevant" sso = "not_relevant"
disk = "40M" disk = "50M"
ram.build = "0M" ram.build = "50M"
ram.runtime = "0M" ram.runtime = "20M"
[install] [install]
@ -43,11 +43,13 @@ ram.runtime = "0M"
[resources.sources] [resources.sources]
[resources.sources.main] [resources.sources.main]
url = "https://github.com/gchq/CyberChef/releases/download/v9.55.0/CyberChef_v9.55.0.zip" url = "https://github.com/gchq/CyberChef/releases/download/v10.4.0/CyberChef_v10.4.0.zip"
sha256 = "da55adc790d011f6bf3740e7e704d340351f7e1c8ebd8e7d9dd24aa46562307c" sha256 = "8485713baeed5fced47e2543b3072032bc9e541d1962b9ee8356b615efa074a2"
extract = true extract = true
zip = true zip = true
in_subdir = false in_subdir = false
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "CyberChef_.*zip"
[resources.system_user] [resources.system_user]

View file

@ -9,6 +9,9 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
upstream_version=$(ynh_app_upstream_version)
index_page="CyberChef_v${upstream_version}.html"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================

View file

@ -9,6 +9,9 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
upstream_version=$(ynh_app_upstream_version)
index_page="CyberChef_v${upstream_version}.html"
#================================================= #=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#================================================= #=================================================

View file

@ -11,6 +11,9 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
upstream_version=$(ynh_app_upstream_version)
index_page="CyberChef_v${upstream_version}.html"
#================================================= #=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD, ETC...) # "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD, ETC...)
#================================================= #=================================================
@ -30,6 +33,7 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4
ynh_add_nginx_config ynh_add_nginx_config