diff --git a/manifest.toml b/manifest.toml index ee19503..66eebb0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "ifconfig-io" @@ -43,10 +45,10 @@ ram.runtime = "50M" default = "visitors" [resources] - [resources.sources.main] - url = "https://github.com/georgyo/ifconfig.io/archive/57dcaffc5c74ae40ca3143ceeb0af64bf436ee63.tar.gz" - sha256 = "c3d7cfe762f7525e07524219a708ccdf2c4c57d4a6cea6eedcbababdd1069780" - autoupdate.strategy = "latest_github_commit" + [resources.sources.main] + url = "https://github.com/georgyo/ifconfig.io/archive/57dcaffc5c74ae40ca3143ceeb0af64bf436ee63.tar.gz" + sha256 = "c3d7cfe762f7525e07524219a708ccdf2c4c57d4a6cea6eedcbababdd1069780" + autoupdate.strategy = "latest_github_commit" [resources.system_user] diff --git a/scripts/_common.sh b/scripts/_common.sh index f75fd24..8258b22 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,3 +1,21 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + GO_VERSION="1.22" + +app_path="$install_dir/go/src/github.com/georgyo/ifconfig.io" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index e21c492..450b42f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 4b6446e..c35f57d 100755 --- a/scripts/install +++ b/scripts/install @@ -3,14 +3,12 @@ source _common.sh source /usr/share/yunohost/helpers -app_path="$install_dir/go/src/github.com/georgyo/ifconfig.io" - #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Installing go..." --weight=5 -ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION +ynh_exec_warn_less ynh_install_go --go_version="$GO_VERSION" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -20,7 +18,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_setup_source --dest_dir="$app_path" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC SETUP @@ -34,8 +32,8 @@ export GOCACHE="$install_dir/go/.cache" export GO111MODULE=on pushd "$app_path" - ynh_exec_warn_less $ynh_go mod download - ynh_exec_warn_less $ynh_go build -tags=jsoniter + ynh_exec_warn_less ynh_exec_as "$app" "$ynh_go" mod download + ynh_exec_warn_less ynh_exec_as "$app" "$ynh_go" build -tags=jsoniter popd #================================================= @@ -51,7 +49,7 @@ ynh_add_systemd_config # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="/var/log/$app/$app.log" -yunohost service add $app --description="IP address API" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="IP address API" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -59,7 +57,7 @@ yunohost service add $app --description="IP address API" --log="/var/log/$app/$a ynh_script_progression --message="Starting service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index cf30a22..f8f0d93 100755 --- a/scripts/remove +++ b/scripts/remove @@ -4,13 +4,12 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 +if ynh_exec_warn_less yunohost service status $app >/dev/null; then yunohost service remove $app fi diff --git a/scripts/restore b/scripts/restore index 882eee9..5fb75a5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -17,19 +15,17 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" mkdir -p "/var/log/$app" -chown -R $app: "/var/log/$app" +chown -R "$app:" "/var/log/$app" -#================================================= -# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=5 -ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION +ynh_exec_warn_less ynh_install_go --go_version="$GO_VERSION" #================================================= # RESTORE SYSTEMD @@ -48,7 +44,7 @@ yunohost service add $app --description="IP address API" --log="/var/log/$app/$a #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" diff --git a/scripts/upgrade b/scripts/upgrade index ce7ab03..880d060 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,17 +3,13 @@ source _common.sh source /usr/share/yunohost/helpers -app_path="$install_dir/go/src/github.com/georgyo/ifconfig.io" - #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading go..." --weight=5 -ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION +ynh_exec_warn_less ynh_install_go --go_version="$GO_VERSION" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -29,7 +25,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_setup_source --dest_dir="$app_path" --full_replace=1 chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC UPGRADE @@ -42,8 +38,8 @@ export GOCACHE="$install_dir/go/.cache" export GO111MODULE=on pushd "$app_path" - ynh_exec_warn_less $ynh_go mod download - ynh_exec_warn_less $ynh_go build -tags=jsoniter + ynh_exec_warn_less ynh_exec_as "$app" "$ynh_go" mod download + ynh_exec_warn_less ynh_exec_as "$app" "$ynh_go" build -tags=jsoniter popd #================================================= @@ -57,14 +53,14 @@ ynh_add_systemd_config ynh_use_logrotate --non-append -yunohost service add $app --description="IP address API" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="IP address API" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/tests.toml b/tests.toml index 91daf17..953b195 100644 --- a/tests.toml +++ b/tests.toml @@ -1,7 +1,9 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default] # ------------ # Tests to run - # ------------ \ No newline at end of file + # ------------