Add copy apps for better upgrade
This commit is contained in:
parent
e6d397c829
commit
a808e84bc3
56
nextcloud.sh
56
nextcloud.sh
|
@ -43,45 +43,45 @@ read -p "Nextcloud version ? " VERSION
|
||||||
|
|
||||||
info "Check if require folders exist"
|
info "Check if require folders exist"
|
||||||
|
|
||||||
if [ -d "$FOLDER/nextcloud" ]; then
|
if [ -d "${FOLDER}/nextcloud" ]; then
|
||||||
warning "Aborded installation exist. Remove nextcloud/ folder"
|
warning "Aborded installation exist. Remove nextcloud/ folder"
|
||||||
rm -rf $FOLDER/nextcloud || fatal "Error when removing folder. Exiting"
|
rm -rf ${FOLDER}/nextcloud || fatal "Error when removing folder. Exiting"
|
||||||
rm nextcloud-* || fatal "Error when removing nextcloud-* .zip, .zip.sha256, .zip.asc. Please remove $FOLDER/nextcloud and $FOLDER/nextcloud-* and retry"
|
rm nextcloud-* || fatal "Error when removing nextcloud-* .zip, .zip.sha256, .zip.asc. Please remove $FOLDER/nextcloud and $FOLDER/nextcloud-* and retry"
|
||||||
fi
|
fi
|
||||||
if [ -d "$FOLDER/www" ]; then
|
if [ -d "${FOLDER}/www" ]; then
|
||||||
info "www/ directory exist, continue"
|
info "www/ directory exist, continue"
|
||||||
NEW_INSTALLATION=false
|
NEW_INSTALLATION=false
|
||||||
else
|
else
|
||||||
warning "www/ directory don't exist, creating"
|
warning "www/ directory don't exist, creating"
|
||||||
mkdir $FOLDER/www || fatal "Error when creating folder. Exiting"
|
mkdir ${FOLDER}/www || fatal "Error when creating folder. Exiting"
|
||||||
NEW_INSTALLATION=true
|
NEW_INSTALLATION=true
|
||||||
fi
|
fi
|
||||||
if [ -d "$FOLDER/data" ]; then
|
if [ -d "${FOLDER}/data" ]; then
|
||||||
info "data/ directory exist, continue"
|
info "data/ directory exist, continue"
|
||||||
else
|
else
|
||||||
warning "data/ directory don't exist, creating"
|
warning "data/ directory don't exist, creating"
|
||||||
mkdir $FOLDER/data || fatal "Error when creating folder. Exiting"
|
mkdir ${FOLDER}/data || fatal "Error when creating folder. Exiting"
|
||||||
NEW_INSTALLATION=true
|
NEW_INSTALLATION=true
|
||||||
fi
|
fi
|
||||||
if [ -d "$FOLDER/config" ]; then
|
if [ -d "${FOLDER}/config" ]; then
|
||||||
info "config/ directory exist, continue"
|
info "config/ directory exist, continue"
|
||||||
else
|
else
|
||||||
warning "config/ directory don't exist, creating"
|
warning "config/ directory don't exist, creating"
|
||||||
mkdir $FOLDER/config || fatal "Error when creating folder. Exiting"
|
mkdir ${FOLDER}/config || fatal "Error when creating folder. Exiting"
|
||||||
NEW_INSTALLATION=true
|
NEW_INSTALLATION=true
|
||||||
fi
|
fi
|
||||||
if [ -d "$FOLDER/apps" ]; then
|
if [ -d "${FOLDER}/apps" ]; then
|
||||||
info "apps/ directory exist, continue"
|
info "apps/ directory exist, continue"
|
||||||
else
|
else
|
||||||
warning "apps/ directory don't exist, creating"
|
warning "apps/ directory don't exist, creating"
|
||||||
mkdir $FOLDER/apps || fatal "Error when creating folder. Exiting"
|
mkdir ${FOLDER}/apps || fatal "Error when creating folder. Exiting"
|
||||||
NEW_INSTALLATION=true
|
NEW_INSTALLATION=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download nextcloud
|
# Download nextcloud
|
||||||
info "Download Nextcloud $VERSION"
|
info "Download Nextcloud ${VERSION}"
|
||||||
wget -q https://download.nextcloud.com/server/releases/nextcloud-$VERSION.zip || fatal "Download failed. Please retry"
|
wget -q https://download.nextcloud.com/server/releases/nextcloud-${VERSION}.zip || fatal "Download failed. Please retry"
|
||||||
if [ ! -f "$FOLDER/nextcloud-$VERSION.zip" ]; then
|
if [ ! -f "${FOLDER}/nextcloud-${VERSION}.zip" ]; then
|
||||||
fatal "Download of Nextcloud archive failed. Please retry"
|
fatal "Download of Nextcloud archive failed. Please retry"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -92,22 +92,22 @@ if [ ! -f "$FOLDER/nextcloud-$VERSION.zip.sha256" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Download asc of Nextcloud"
|
info "Download asc of Nextcloud"
|
||||||
wget -q https://download.nextcloud.com/server/releases/nextcloud-$VERSION.zip.asc || fatal "Download of Nextcloud signature failed. Please retry"
|
wget -q https://download.nextcloud.com/server/releases/nextcloud-${VERSION}.zip.asc || fatal "Download of Nextcloud signature failed. Please retry"
|
||||||
if [ ! -f "$FOLDER/nextcloud-$VERSION.zip.asc" ]; then
|
if [ ! -f "${FOLDER}/nextcloud-${VERSION}.zip.asc" ]; then
|
||||||
fatal "Download of Nextcloud signature failed. Please retry"
|
fatal "Download of Nextcloud signature failed. Please retry"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check integrity nextcloud
|
# Check integrity nextcloud
|
||||||
info "Check nextcloud integrity"
|
info "Check nextcloud integrity"
|
||||||
sha256sum -c nextcloud-$VERSION.zip.sha256 >/dev/null || fatal "Checksum did not match"
|
sha256sum -c nextcloud-${VERSION}.zip.sha256 >/dev/null || fatal "Checksum did not match"
|
||||||
gpg -q --verify nextcloud-$VERSION.zip.asc 2>/dev/null|| fatal "Signature is not good"
|
gpg -q --verify nextcloud-${VERSION}.zip.asc 2>/dev/null|| fatal "Signature is not good"
|
||||||
|
|
||||||
info "Start update"
|
info "Start update"
|
||||||
|
|
||||||
info "Unzip Nextcloud $VERSION"
|
info "Unzip Nextcloud ${VERSION}"
|
||||||
unzip -q nextcloud-$VERSION.zip
|
unzip -q nextcloud-${VERSION}.zip
|
||||||
|
|
||||||
if [[ $NEW_INSTALLATION == "false" ]]; then
|
if [[ ${NEW_INSTALLATION} == "false" ]]; then
|
||||||
info "Unlink folders that contain the data"
|
info "Unlink folders that contain the data"
|
||||||
unlink www/data
|
unlink www/data
|
||||||
unlink www/config
|
unlink www/config
|
||||||
|
@ -116,24 +116,28 @@ if [[ $NEW_INSTALLATION == "false" ]]; then
|
||||||
|
|
||||||
info "Backuping old installation"
|
info "Backuping old installation"
|
||||||
tar -zcf "www.$(date '+%Y-%m-%d').tar.gz" www
|
tar -zcf "www.$(date '+%Y-%m-%d').tar.gz" www
|
||||||
|
tar -zcf "apps.$(date '+%Y-%m-%d').tar.gz" apps
|
||||||
|
|
||||||
info "Removing old installation"
|
info "Removing old installation"
|
||||||
rm -rf www/*
|
rm -rf www/*
|
||||||
|
|
||||||
|
info "Copying news apps files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
info "Copying new Nextcloud"
|
info "Copying new Nextcloud"
|
||||||
|
cp -rf nextcloud/apps/* apps/
|
||||||
|
rm -rf nextcloud/{config,data,apps}
|
||||||
cp -rf nextcloud/* www/
|
cp -rf nextcloud/* www/
|
||||||
rm -rf www/{config,data,apps}
|
|
||||||
|
|
||||||
info "Link folders that contain the data into new installation"
|
info "Link folders that contain the data into new installation"
|
||||||
ln -s $FOLDER/data $FOLDER/www/
|
ln -s ${FOLDER}/data ${FOLDER}/www/
|
||||||
ln -s $FOLDER/config $FOLDER/www/
|
ln -s ${FOLDER}/config ${FOLDER}/www/
|
||||||
ln -s $FOLDER/apps $FOLDER/www/
|
ln -s ${FOLDER}/apps ${FOLDER}/www/
|
||||||
|
|
||||||
info "Removing archive and temp folder"
|
info "Removing archive and temp folder"
|
||||||
rm -rf nextcloud-$VERSION.zip* ../nextcloud/
|
rm -rf nextcloud-${VERSION}.zip* ../nextcloud/
|
||||||
|
|
||||||
info "Setting good permission"
|
info "Setting good permission"
|
||||||
cd www/
|
cd www/
|
||||||
|
@ -147,7 +151,7 @@ info "Launch integrity check"
|
||||||
php occ check
|
php occ check
|
||||||
|
|
||||||
read -n1 -p "Would you like scann all file (recommanded) [y,n]" SCAN
|
read -n1 -p "Would you like scann all file (recommanded) [y,n]" SCAN
|
||||||
case $SCAN in
|
case ${SCAN} in
|
||||||
y|Y) info "Launch files scan" && php console.php files:scan --all ;;
|
y|Y) info "Launch files scan" && php console.php files:scan --all ;;
|
||||||
n|N) info "Don't launch files scan" ;;
|
n|N) info "Don't launch files scan" ;;
|
||||||
*) echo Please use y or n ;;
|
*) echo Please use y or n ;;
|
||||||
|
|
Loading…
Reference in a new issue