Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create nextcloud_vm #1120

Closed
wants to merge 14 commits into from
5 changes: 5 additions & 0 deletions nextcloud_install_production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,11 @@ fi
# Force MOTD to show correct number of updates
sudo /usr/lib/update-notifier/update-motd-updates-available --force

if [ -f "$SCRIPTS"/nextcloud_install_production.sh ]
then
rm "$SCRIPTS"/nextcloud_install_production.sh
fi

# Reboot
print_text_in_color "$IGreen" "Installation done, system will now reboot..."
reboot
51 changes: 51 additions & 0 deletions nextcloud_vm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/

# Variables:
SCRIPTS=/var/scripts

# Check if root
if [[ "$EUID" -ne 0 ]]
then
echo "You have to run this script as root! Exiting..."
exit 1
fi

# Todo: Test internet connection

# Todo: Verify the release package and integrity with the gpg key

# Todo: Download the release package (.tar) file

# Todo: Verify the state of the downloaded package with a checksum?

# Todo: Extract everything to "$SCRIPTS"
mkdir -p "$SCRIPTS"

# This is for testing purposes only; should get removed if everything above is ready.
if [ ! -d "$SCRIPTS"/apps ] && [ ! -d "$SCRIPTS"/main ] && [ ! -d "$SCRIPTS"/lets-encrypt ] && [ ! -d "$SCRIPTS"/static ]
then
git clone https://github.com/nextcloud/vm.git "$SCRIPTS"
# Remove all unnecessary files
rm -r "$SCRIPTS"/.git
rm "$SCRIPTS"/LICENSE
rm "$SCRIPTS"/issue_template.md
rm "$SCRIPTS"/.travis.yml
rm "$SCRIPTS"/README.md
rm "$SCRIPTS"/nextcloud_vm.sh
fi

# Move all main files to "$SCRIPTS"/main (apart from install-production and startup-script)
mkdir -p "$SCRIPTS"/main
mv "$SCRIPTS"/lib.sh "$SCRIPTS"/main
mv "$SCRIPTS"/nextcloud_update.sh "$SCRIPTS"/main

# Set ownership and permission
chown -R root:root "$SCRIPTS"
chmod -R +x "$SCRIPTS"

# Run the nextcloud_install_production script
bash "$SCRIPTS"/nextcloud_install_production.sh

exit