1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/bash
- ynh_setting() {
- app=${1}
- setting=${2}
- sudo grep "^${setting}:" "/etc/yunohost/apps/${app}/settings.yml" | sed s/^[^:]\\+:\\s*[\"\']\\?// | sed s/\\s*[\"\']\$//
- }
- source ./helpers
- domain=$(ynh_setting piratebox domain)
- path=$(ynh_setting piratebox path)
- opt_domain=$(ynh_setting piratebox opt_domain)
- opt_name=$(ynh_setting piratebox opt_name)
- opt_deleting=$(ynh_setting piratebox opt_deleting)
- opt_renaming=$(ynh_setting piratebox opt_renaming)
- opt_chat=$(ynh_setting piratebox opt_chat)
- tmpdir=$(mktemp -dp /tmp/ piratebox-upgrade-XXXXX)
- sudo cp -a /etc/yunohost/apps/piratebox/settings.yml "${tmpdir}/"
- sudo mv /var/www/piratebox/public/uploads/ "${tmpdir}/"
- export PIRATEBOX_UPGRADE=1
- sudo bash /etc/yunohost/apps/piratebox/scripts/remove &> /dev/null
- bash ./install "${domain}" "${path}" "${opt_domain}" "${opt_name}" "${opt_deleting}" "${opt_renaming}" "${opt_chat}"
- gitcommit_upstream=$(ynh_setting piratebox gitcommit_upstream)
- sudo cp -a "${tmpdir}/settings.yml" /etc/yunohost/apps/piratebox/
- sudo mv "${tmpdir}/uploads/"* /var/www/piratebox/public/uploads/ 2> /dev/null
- sudo rm -r "${tmpdir}/"
- sudo yunohost app setting piratebox gitcommit_upstream -v "${gitcommit_upstream}"
- # Changes
- if [ -z "$(ynh_setting piratebox opt_maxspace)" ]; then
- sudo yunohost app setting piratebox opt_maxspace -v 90
- fi
- ynh_systemctl start ynh-piratebox
- exit 0
|