1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Move hub to /usr/bin so nginx & uwsgi can see it

This commit is contained in:
Jean-Baptiste Holcroft 2017-12-29 08:43:56 +01:00
parent 0d0a384078
commit 3664dc8cd2
5 changed files with 38 additions and 9 deletions

View file

@ -21,7 +21,7 @@
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# latest published in community.json # latest published in community.json
upgrade=1 from_commit=58c98267fa4c3ea5c1ff8fd4c63655a3230a2134 upgrade=1 from_commit=74f93c22e57e0174f67b570875c9e10bbca0a6c8
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 incorrect_path=1

View file

@ -64,3 +64,9 @@ ynh_backup "/etc/cron.d/$app"
ynh_backup "/etc/uwsgi/apps-available/$app.ini" ynh_backup "/etc/uwsgi/apps-available/$app.ini"
ynh_backup "/etc/systemd/system/uwsgi-app@.socket" ynh_backup "/etc/systemd/system/uwsgi-app@.socket"
ynh_backup "/etc/systemd/system/uwsgi-app@.service" ynh_backup "/etc/systemd/system/uwsgi-app@.service"
#=================================================
# BACKUP THE hub binary file
#=================================================
ynh_backup /usr/bin/hub

View file

@ -156,8 +156,7 @@ esac
[[ $(sha256sum "$file_bin" | cut -d' ' -f1) = "$sha256sum" ]] || ynh_die "Hub's sha256sum failed (arch: ${arch})" [[ $(sha256sum "$file_bin" | cut -d' ' -f1) = "$sha256sum" ]] || ynh_die "Hub's sha256sum failed (arch: ${arch})"
tar --extract --file "$file_bin" "$version/bin/hub" tar --extract --file "$file_bin" "$version/bin/hub"
mkdir "$final_path/bin/" mv "$version/bin/hub" /usr/bin/
mv "$version/bin/hub" "$final_path/bin/"
mkdir "$final_path/.config/" mkdir "$final_path/.config/"
cp ../conf/hub_config "$final_path/.config/hub" cp ../conf/hub_config "$final_path/.config/hub"
@ -166,7 +165,6 @@ ynh_replace_string "__GITHUBTOKEN__" "$github_token" "$final_path/.config/hub"
cat <<EOF > "$final_path/.bashrc" cat <<EOF > "$final_path/.bashrc"
alias git=hub alias git=hub
PATH="\$PATH:$final_path/bin"
EOF EOF
#================================================= #=================================================

View file

@ -12,9 +12,14 @@ if [ ! -e _common.sh ]; then
chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
if [ ! -e _future.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_future.sh ./_future.sh
chmod a+rx _future.sh
fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source _future.sh
ynh_abort_if_errors ynh_abort_if_errors
@ -125,6 +130,12 @@ yunohost service add "uwsgi-app@$app.socket" --log "/var/log/uwsgi/app/$app"
ynh_restore_file "/etc/cron.d/$app" ynh_restore_file "/etc/cron.d/$app"
#=================================================
# RESTORE THE HUB BINARY FILE
#=================================================
ynh_restore_file "/usr/bin/hub"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -57,12 +57,13 @@ elif [ "$is_public" = "No" ]; then
is_public=0 is_public=0
fi fi
# (<2.17)
if [ -z "$db_name" ]; then # If db_name doesn't exist, create it if [ -z "$db_name" ]; then # If db_name doesn't exist, create it
db_name=$(ynh_sanitize_dbid "$app") db_name=$(ynh_sanitize_dbid "$app")
ynh_app_setting_set "$app" db_name "$db_name" ynh_app_setting_set "$app" db_name "$db_name"
fi fi
# handle python3 migration (because of django 2.0) # (<2.18) handle python3 migration (because of django 2.0)
if [[ -e "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" ]] if [[ -e "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" ]]
then then
settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
@ -72,7 +73,7 @@ else
migrate_py2to3=false migrate_py2to3=false
fi fi
# save memc_port if it doesn't exist # (<2.17) save memc_port if it doesn't exist
if [[ -z "$memc_port" ]] if [[ -z "$memc_port" ]]
then then
memc_port=$(cat "$settings" \ memc_port=$(cat "$settings" \
@ -81,7 +82,7 @@ then
ynh_app_setting_set "$app" memc_port "$memc_port" ynh_app_setting_set "$app" memc_port "$memc_port"
fi fi
# migrade old uwsgi files if existing # (<2.18) migrade old uwsgi files if existing
if [ -e "/etc/systemd/system/$app.service" ] if [ -e "/etc/systemd/system/$app.service" ]
then then
systemctl stop "$app.service" systemctl stop "$app.service"
@ -91,6 +92,18 @@ then
ynh_secure_remove "/etc/systemd/system/$app.service" ynh_secure_remove "/etc/systemd/system/$app.service"
fi fi
# (<2.18) move hub to the correct folder
if [ -e "$final_path/bin/hub" ]
then
mv "$final_path/bin/hub" /usr/bin/
chown root:root /usr/bin/hub
fi
if [[ -d "$final_path/bin/" ]]
then
ynh_secure_remove "$final_path/bin/"
fi
#================================================= #=================================================
# CHECK THE PATH # CHECK THE PATH
#================================================= #=================================================
@ -146,7 +159,8 @@ ynh_add_uwsgi_service
# save old settings file # save old settings file
cp "$settings" "$final_path/settings.$previous_version.old.py" cp "$settings" "$final_path/settings.$previous_version.old.py"
# handle python3 migration
# (<2.18) handle python3 migration
if [[ "$migrate_py2to3" = true ]] if [[ "$migrate_py2to3" = true ]]
then then
ynh_secure_remove "$final_path/venv" ynh_secure_remove "$final_path/venv"