committed by
GitHub
8 changed files with 218 additions and 88 deletions
-
4manifest.json
-
33scripts/_common.sh
-
105scripts/upgrade
-
62scripts/upgrade.d/owncloud.sh
-
18scripts/upgrade.d/upgrade.10.sh
-
18scripts/upgrade.d/upgrade.9.sh
-
48scripts/upgrade.d/upgrade.generic.sh
-
18scripts/upgrade.d/upgrade.last.sh
@ -0,0 +1,62 @@ |
|||
#!/bin/bash |
|||
|
|||
# Préparation à la migration de owncloud 9 vers nextcloud. |
|||
# La migration sera effective lors de la mise à joru qui suivra |
|||
|
|||
# Load common variables and helpers |
|||
source ./_common.sh |
|||
|
|||
# Source app helpers |
|||
source /usr/share/yunohost/helpers |
|||
|
|||
# Set app specific variables |
|||
app=$APPNAME |
|||
dbname=$app |
|||
dbuser=$app |
|||
|
|||
# check that Nextcloud is not already installed |
|||
(sudo yunohost app list --installed -f "$app" | grep -q id) \ |
|||
&& ynh_die "Nextcloud is already installed" |
|||
|
|||
# retrieve ownCloud app settings |
|||
real_app=$YNH_APP_INSTANCE_NAME # real_app prend le nom de owncloud. |
|||
domain=$(ynh_app_setting_get "$real_app" domain) |
|||
oc_dbpass=$(ynh_app_setting_get "$real_app" mysqlpwd) |
|||
oc_dbname=$real_app |
|||
oc_dbuser=$real_app |
|||
|
|||
# remove nginx and php-fpm configuration files |
|||
sudo rm -f \ |
|||
"/etc/nginx/conf.d/${domain}.d/${real_app}.conf" \ |
|||
"/etc/php5/fpm/pool.d/${real_app}.conf" \ |
|||
"/etc/cron.d/${real_app}" |
|||
|
|||
# reload services to disable php-fpm and nginx config for ownCloud |
|||
sudo service php5-fpm reload || true |
|||
sudo service nginx reload || true |
|||
|
|||
# remove dependencies package |
|||
ynh_package_remove owncloud-deps || true |
|||
|
|||
# clean new destination and data directories |
|||
DESTDIR="/var/www/$app" |
|||
DATADIR="/home/yunohost.app/${app}/data" |
|||
SECURE_REMOVE '$DESTDIR' # Supprime le dossier de nextcloud dans /var/www le cas échéant |
|||
SECURE_REMOVE '/home/yunohost.app/$app' # Et dans yunohost.app |
|||
|
|||
# rename ownCloud folders |
|||
sudo mv "/var/www/$real_app" "$DESTDIR" # Puis renomme les dossiers de owncloud en nextcloud |
|||
sudo mv "/home/yunohost.app/$real_app" "/home/yunohost.app/$app" |
|||
sudo sed -ri "s#^(\s*'datadirectory' =>).*,#\1 '${DATADIR}',#" \ |
|||
"/var/www/${app}/config/config.php" # Change l'emplacement du dossier de data dans le fichier de config |
|||
|
|||
# rename the MySQL database |
|||
rename_mysql_db "$oc_dbname" "$oc_dbuser" "$oc_dbpass" "$dbname" "$dbuser" |
|||
sudo sed -ri "s#^(\s*'dbname' =>).*,#\1 '${dbname}',#" \ |
|||
"/var/www/${app}/config/config.php" |
|||
sudo sed -ri "s#^(\s*'dbuser' =>).*,#\1 '${dbuser}',#" \ |
|||
"/var/www/${app}/config/config.php" |
|||
|
|||
# rename ownCloud system group and account |
|||
sudo groupmod -n "$app" "$real_app" |
|||
sudo usermod -l "$app" "$real_app" |
|||
@ -0,0 +1,18 @@ |
|||
#!/bin/bash |
|||
|
|||
# Version cible de la mise à jour de Nextcloud |
|||
VERSION="11.0.0" |
|||
|
|||
# Nextcloud tarball checksum |
|||
NEXTCLOUD_SOURCE_SHA256="5bdfcb36c5cf470b9a6679034cabf88bf1e50a9f3e47c08d189cc2280b621429" |
|||
|
|||
# Load common variables and helpers |
|||
source ./_common.sh |
|||
|
|||
# Source app helpers |
|||
source /usr/share/yunohost/helpers |
|||
|
|||
# Load common upgrade function |
|||
source ./upgrade.d/upgrade.generic.sh |
|||
|
|||
COMMON_UPGRADE # Met à jour Nextcloud vers la version suivante |
|||
@ -0,0 +1,18 @@ |
|||
#!/bin/bash |
|||
|
|||
# Version cible de la mise à jour de Nextcloud |
|||
VERSION="10.0.2" |
|||
|
|||
# Nextcloud tarball checksum |
|||
NEXTCLOUD_SOURCE_SHA256="a687a818778413484f06bb23b4e98589c73729fe2aa9feb1bf5584e3bd37103c" |
|||
|
|||
# Load common variables and helpers |
|||
source ./_common.sh |
|||
|
|||
# Source app helpers |
|||
source /usr/share/yunohost/helpers |
|||
|
|||
# Load common upgrade function |
|||
source ./upgrade.d/upgrade.generic.sh |
|||
|
|||
COMMON_UPGRADE # Met à jour Nextcloud vers la version suivante |
|||
@ -0,0 +1,48 @@ |
|||
#!/bin/bash |
|||
|
|||
# Fonction rassemblant les opérations communes de mise à jour. |
|||
|
|||
# occ helper for the current installation |
|||
_exec_occ() { |
|||
exec_occ "$DESTDIR" "$app" $@ # Appel de php occ avec les droits de l'user nextcloud. A noter que ce n'est là que la déclaration de la fonction qui sera appelée plus tard. |
|||
} |
|||
|
|||
COMMON_UPGRADE () { |
|||
app=$APPNAME |
|||
DESTDIR="/var/www/$app" |
|||
DATADIR="/home/yunohost.app/$app/data" |
|||
domain=$(ynh_app_setting_get "$YNH_APP_INSTANCE_NAME" domain) # Utilise $YNH_APP_INSTANCE_NAME au lieu de $app pour utiliser la config de owncloud en cas de migration |
|||
|
|||
# Retrieve new Nextcloud sources in a temporary directory |
|||
TMPDIR=$(mktemp -d) |
|||
extract_nextcloud "$TMPDIR" # Télécharge nextcloud, vérifie sa somme de contrôle et le décompresse. |
|||
|
|||
# Copy Nextcloud configuration file |
|||
sed -i "s@#DOMAIN#@${domain}@g" ../conf/config.json |
|||
sed -i "s@#DATADIR#@${DATADIR}@g" ../conf/config.json |
|||
sudo cp ../conf/config.json "${TMPDIR}/config.json" |
|||
|
|||
# Enable maintenance mode |
|||
_exec_occ maintenance:mode --on |
|||
|
|||
# Copy config and 3rd party applications from current directory |
|||
sudo cp -a "${DESTDIR}/config/config.php" "${TMPDIR}/config/config.php" |
|||
for a in $(sudo ls "${DESTDIR}/apps"); do |
|||
[[ ! -d "${TMPDIR}/apps/$a" ]] \ |
|||
&& sudo cp -a "${DESTDIR}/apps/$a" "${TMPDIR}/apps/$a" |
|||
done |
|||
|
|||
# Rename existing app directory and move new one |
|||
SECURE_REMOVE '$DESTDIR' # Supprime le dossier actuel de nextcloud |
|||
sudo mv "$TMPDIR" "$DESTDIR" # Et le remplace par la nouvelle version du dossier temporaire |
|||
sudo chmod +x "$DESTDIR" |
|||
|
|||
# Set app folders ownership |
|||
sudo chown -R $app: "$DESTDIR" "$DATADIR" |
|||
|
|||
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) |
|||
# TODO: Restore old directory in case of failure? |
|||
_exec_occ maintenance:mode --off |
|||
_exec_occ upgrade \ |
|||
|| ([[ $? -eq 3 ]] || ynh_die "Unable to upgrade Nextcloud") |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
#!/bin/bash |
|||
|
|||
# Version cible de la mise à jour de Nextcloud |
|||
VERSION="11.0.0" |
|||
|
|||
# Nextcloud tarball checksum |
|||
NEXTCLOUD_SOURCE_SHA256="5bdfcb36c5cf470b9a6679034cabf88bf1e50a9f3e47c08d189cc2280b621429" |
|||
|
|||
# Load common variables and helpers |
|||
source ./_common.sh |
|||
|
|||
# Source app helpers |
|||
source /usr/share/yunohost/helpers |
|||
|
|||
# Load common upgrade function |
|||
source ./upgrade.d/upgrade.generic.sh |
|||
|
|||
COMMON_UPGRADE # Met à jour Nextcloud vers la version suivante |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue