From c8c9ae3cfd3016be862017d0763965b9a121ff52 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Jun 2021 15:30:36 +0200 Subject: [PATCH] Fix --- conf/app.src | 7 +++++ scripts/install | 69 ++++++++++++------------------------------------- 2 files changed, 23 insertions(+), 53 deletions(-) create mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src new file mode 100644 index 0000000..3729d4d --- /dev/null +++ b/conf/app.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://github.com/muesli/beehive/releases/download/v0.4.0/beehive_0.4.0_Linux_x86_64.tar.gz +SOURCE_SUM=f1959bc2f7c19d4ec8eaabc7b78492836afcc3bcd75d034854e66607efa9efab +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/scripts/install b/scripts/install index bea86d7..ae26437 100755 --- a/scripts/install +++ b/scripts/install @@ -33,11 +33,8 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= - ynh_script_progression --message="Validating installation parameters..." --weight=1 -### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -47,7 +44,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -58,82 +55,54 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port port=$(ynh_find_port --port=8181) ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 - +ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies -# Install Go -tmpdir="$(ynh_smart_mktemp)" -pushd "$tmpdir" - wget https://golang.org/dl/go$GO_VERSION.linux-$architecture.tar.gz - ynh_secure_remove /usr/local/go - tar -C /usr/local -xzf go$GO_VERSION.linux-$architecture.tar.gz -popd -ynh_secure_remove "$tmpdir" -export PATH=$PATH:/usr/local/go/bin -export GOPATH=/usr/local/go/bin +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 - -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src +ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$final_path" -git clone --recursive https://github.com/muesli/beehive.git "$final_path" -pushd "$final_path" - make -popd +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # SETUP SYSTEMD #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_systemd_config --service="$app" --template="systemd.service" --others_var="port domain" - - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -chown -R $app: $final_path +ynh_add_systemd_config #================================================= # SETUP LOGROTATE @@ -147,7 +116,6 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="$app service" --log="/var/log/$app/$app.log" #================================================= @@ -155,21 +123,16 @@ yunohost service add $app --description="$app service" --log="/var/log/$app/$app #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 - ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - - #================================================= # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 - # Only the admin can access the admin panel of the app (if the app has an admin panel) ynh_permission_update --permission "main" --remove all_users --add $admin - #================================================= # RELOAD NGINX #=================================================