Move bin directory from /var/www to /opt/yunohost for old installations

This commit is contained in:
Josué Tille 2019-08-05 15:34:00 +02:00
parent a50778b691
commit 9ba4741bb1
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
7 changed files with 33 additions and 48 deletions

View file

@ -10,28 +10,6 @@ app=$YNH_APP_INSTANCE_NAME
# DEFINE ALL COMMON FONCTIONS # DEFINE ALL COMMON FONCTIONS
#================================================= #=================================================
get_configuration() {
final_path=$(ynh_app_setting_get --app $app --key final_path)
seafile_user=$(ynh_app_setting_get --app $app --key seafile_user)
if [[ -z $final_path ]] || [[ -z $seafile_user ]]
then
if [[ -e /var/www/$app ]]
then
final_path=/var/www/$app
seafile_user=www-data
elif [[ -e /opt/yunohost/$app ]]
then
final_path=/opt/yunohost/$app
seafile_user=seafile
else
ynh_die --message "Error : can't find seafile path"
fi
ynh_app_setting_set --app $app --key final_path --value $final_path
ynh_app_setting_set --app $app --key seafile_user --value $seafile_user
fi
}
install_source() { install_source() {
mkdir "$final_path/seafile-server-$seafile_version" mkdir "$final_path/seafile-server-$seafile_version"
if [[ $architecture == "i386" ]] if [[ $architecture == "i386" ]]
@ -44,11 +22,7 @@ install_source() {
install_dependance() { install_dependance() {
ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \
libjpeg62-turbo-dev zlib1g-dev # For building pillow libjpeg62-turbo-dev zlib1g-dev # For building pillow
if [[ "$seafile_user" == seafile ]] && [[ "$final_path" == "/opt/yunohost/$app" ]] ; then sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' certifi idna
sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' certifi idna
else
pip install --upgrade Pillow 'moviepy<1.0'
fi
} }
set_permission() { set_permission() {

View file

@ -16,12 +16,11 @@ source ../settings/scripts/_common.sh
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Set configuration for user and final path
get_configuration
# retrieve useful param # retrieve useful param
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app $app --key domain)
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
final_path=$(ynh_app_setting_get --app $app --key final_path)
seafile_user=$app
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS

View file

@ -24,9 +24,8 @@ path_url=$(ynh_normalize_url_path $YNH_APP_NEW_PATH)
seahub_port=$(ynh_app_setting_get --app $app --key seahub_port) seahub_port=$(ynh_app_setting_get --app $app --key seahub_port)
fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port)
webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) webdav_port=$(ynh_app_setting_get --app $app --key webdav_port)
final_path=$(ynh_app_setting_get --app $app --key final_path)
# Get dest folder and system user seafile_user=$app
get_configuration
# Create special path with / at the end # Create special path with / at the end
if [[ $old_path == '/' ]] if [[ $old_path == '/' ]]

View file

@ -24,7 +24,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_PUBLIC_SITE is_public=$YNH_APP_ARG_PUBLIC_SITE
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
final_path=/opt/yunohost/$app final_path=/opt/yunohost/$app
seafile_user=seafile seafile_user=$app
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
# Create special path with / at the end # Create special path with / at the end

View file

@ -16,9 +16,6 @@ source ./_common.sh
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Init get Final path
get_configuration
# Retrieve arguments # Retrieve arguments
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app $app --key domain)

View file

@ -21,6 +21,8 @@ domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path)) path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
final_path=$(ynh_app_setting_get --app $app --key final_path)
seafile_user=$app
# Check domain/path availability # Check domain/path availability
ynh_webpath_available $domain $path_url || ynh_die --message "$domain/$path_url is not available, please use an other domain or path." ynh_webpath_available $domain $path_url || ynh_die --message "$domain/$path_url is not available, please use an other domain or path."
@ -33,11 +35,8 @@ ynh_webpath_available $domain $path_url || ynh_die --message "$domain/$path_url
ynh_script_progression --message="Restoring files..." --weight=10 ynh_script_progression --message="Restoring files..." --weight=10
ynh_restore ynh_restore
# Get configuration for user and final path # Create user
get_configuration ynh_system_user_create $seafile_user $final_path
# Create user if it need
[[ $seafile_user = "seafile" ]] && ynh_system_user_create $seafile_user $final_path
# Restore dependencies # Restore dependencies
ynh_script_progression --message="Reinstalling dependencies..." --weight=5 ynh_script_progression --message="Reinstalling dependencies..." --weight=5

View file

@ -16,9 +16,6 @@ source ./_common.sh
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Init get Final path
get_configuration
# Retrieve arguments # Retrieve arguments
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path)) path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
@ -27,9 +24,8 @@ seahub_port=$(ynh_app_setting_get --app $app --key seahub_port)
fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port)
webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) webdav_port=$(ynh_app_setting_get --app $app --key webdav_port)
root_pwd=$(cat /etc/yunohost/mysql) root_pwd=$(cat /etc/yunohost/mysql)
final_path=$(ynh_app_setting_get --app $app --key final_path)
# Get configuration for user and final path seafile_user=$app
get_configuration
ynh_script_progression --message="Stoping services..." ynh_script_progression --message="Stoping services..."
@ -55,6 +51,27 @@ pkill -f seahub || true
# MIGRATION FROM OLD VERSION # MIGRATION FROM OLD VERSION
#================================================= #=================================================
ynh_script_progression --message="Fixing old settings..." --weight=1
# Get configuration for user and final path
if [ -z $final_path ]; then
if [ -e /var/www/$app ]; then
final_path=/var/www/$app
elif [ -e /opt/yunohost/$app ]; then
final_path=/opt/yunohost/$app
else
ynh_die --message "Error : can't find seafile path"
fi
fi
if [ $final_path == "/var/www/$app" ]; then
final_path="/opt/yunohost/$app"
mv /var/www/$app /opt/yunohost/
ynh_system_user_create --username $seafile_user --home_dir $final_path
ynh_app_setting_set --app $app --key final_path --value $final_path
set_permission
fi
ynh_script_progression --message="Upgrading source files..." --weight=6 ynh_script_progression --message="Upgrading source files..." --weight=6
# extract new version # extract new version