mirror of
https://github.com/EV21/uberspace-helper.git
synced 2026-10-08 04:43:18 +02:00
update uberspace-nextcloud-installer.sh
This commit is contained in:
1 file changed
+34
-25
@@ -13,12 +13,17 @@ function install_nextcloud
|
|||||||
# using bash substring syntax to remove the 9 characters "password="
|
# using bash substring syntax to remove the 9 characters "password="
|
||||||
MYSQL_PASSWORD=${MYSQL_PASSWORD_STR:9}
|
MYSQL_PASSWORD=${MYSQL_PASSWORD_STR:9}
|
||||||
|
|
||||||
rm ~/html/nocontent.html
|
if [ -e ~/html/nocontent.html ]
|
||||||
cd ~/html || exit
|
then rm ~/html/nocontent.html
|
||||||
|
fi
|
||||||
|
# shellcheck disable=2088
|
||||||
|
if [ "$(ls --almost-all ~/html/)" ]; then echo '~/html is not empty, abort!'; exit 1; fi
|
||||||
|
cd ~/html
|
||||||
echo "Downloading Nextcloud to ~/html/"
|
echo "Downloading Nextcloud to ~/html/"
|
||||||
curl https://download.nextcloud.com/server/releases/latest.tar.bz2 |
|
curl --progress-bar https://download.nextcloud.com/server/releases/latest.tar.bz2 |
|
||||||
tar -xjf - --strip-components=1
|
tar -xjf - --strip-components=1
|
||||||
mysql --verbose --execute="CREATE DATABASE ${USER}_nextcloud"
|
mysql --verbose --execute="CREATE DATABASE ${USER}_nextcloud"
|
||||||
|
echo "Installing Nextcloud"
|
||||||
php ~/html/occ maintenance:install \
|
php ~/html/occ maintenance:install \
|
||||||
--admin-user "${NEXTCLOUD_ADMIN_USER}" \
|
--admin-user "${NEXTCLOUD_ADMIN_USER}" \
|
||||||
--admin-pass "${NEXTCLOUD_ADMIN_PASS}" \
|
--admin-pass "${NEXTCLOUD_ADMIN_PASS}" \
|
||||||
@@ -63,18 +68,9 @@ function setup_domains
|
|||||||
{
|
{
|
||||||
echo "You currently have configured the following domains:"
|
echo "You currently have configured the following domains:"
|
||||||
uberspace web domain list
|
uberspace web domain list
|
||||||
while true
|
if yes-no_question "Do you want to add another domain to the web configuration of your uberspace?"
|
||||||
do
|
then add_domain
|
||||||
read -r -p "Do you want to add another domain to the web configuration of your uberspace? (y/n) " ANSWER
|
fi
|
||||||
case $ANSWER in
|
|
||||||
[Yy]* | [Jj]* )
|
|
||||||
add_domain
|
|
||||||
break;;
|
|
||||||
[Nn]* )
|
|
||||||
break;;
|
|
||||||
* ) echo "Please answer yes or no. ";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_domain
|
function add_domain
|
||||||
@@ -197,29 +193,42 @@ end_of_content
|
|||||||
chmod +x ~/bin/nextcloud-update
|
chmod +x ~/bin/nextcloud-update
|
||||||
}
|
}
|
||||||
|
|
||||||
function ask_if_fresh_uberspace
|
function yes-no_question
|
||||||
{
|
{
|
||||||
echo "This script tries to install the latest release of Nextcloud"
|
local question=$1
|
||||||
echo "but it is tested for Nextcloud 23 on Uberspace 7.12.0"
|
|
||||||
echo "and assumes a newly created uberspace with default settings."
|
|
||||||
echo "Do not run this script if you already use your Uberspace for other apps!"
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -r -p "Do you want to execute this installer for Nextcloud? (y/n) " ANSWER
|
read -r -p "$question (y/n) " ANSWER
|
||||||
case $ANSWER in
|
case $ANSWER in
|
||||||
[Yy]* | [Jj]* )
|
[Yy]* | [Jj]* )
|
||||||
install_nextcloud
|
return 0
|
||||||
break;;
|
;;
|
||||||
[Nn]* )
|
[Nn]* )
|
||||||
break;;
|
return 1
|
||||||
|
;;
|
||||||
* ) echo "Please answer yes or no. ";;
|
* ) echo "Please answer yes or no. ";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_critical_section { set -o pipefail -o errexit; }
|
||||||
|
function unset_critical_section { set +o pipefail +o errexit; }
|
||||||
|
|
||||||
function main
|
function main
|
||||||
{
|
{
|
||||||
ask_if_fresh_uberspace
|
set_critical_section
|
||||||
|
|
||||||
|
echo "This script tries to install the latest release of Nextcloud"
|
||||||
|
echo "but it is tested for Nextcloud 23 on Uberspace 7.12.0"
|
||||||
|
echo "and assumes a newly created Uberspace with default settings."
|
||||||
|
echo "Do not run this script if you already use your Uberspace for other apps!"
|
||||||
|
|
||||||
|
if yes-no_question "Do you want to execute this installer for Nextcloud?"
|
||||||
|
then install_nextcloud
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset_critical_section
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
exit $?
|
||||||
Reference in new issue
Block a user