Commit 97016f30 authored by Paul Cammish's avatar Paul Cammish
Browse files

Add --noninteractive switch

parent ce69de78
#!/bin/bash
set -e
if [ $( id -u $(whoami) ) != 0 ]; then
echo "Sorry, this must be run as root."
exit 1
fi
noninteractive=0
codename=$( if ! which lsb_release > /dev/null ; then grep ^VERSION= /etc/os-release | cut -d \( -f 2 | cut -d \) -f 1 ; else lsb_release -c | cut -f 2 ; fi )
case "x$1" in
"x") version="$codename";;
"x--testing") version="$codename-testing" ;;
*) echo "Unknown parameter: $1"; exit 1 ;;
esac
version=$codename
UNHANDLED=()
while [ $# -gt 0 ]; do
case $1 in
--testing)
version="$codename-testing"
shift
;;
--noninteractive)
noninteractive=1
shift
;;
*)
UNHANDLED+=("$1")
shift
;;
esac
done
if [ "x$UNHANDLED" != "x" ]; then
echo "Error: Unknown parameter '$UNHANDLED'"
exit 1
fi
echo
echo "-----------------------------------------------------------------------"
echo " Sympl Installer v0.5"
echo " Sympl Installer v0.6"
echo "-----------------------------------------------------------------------"
echo
echo "This script will help you install Sympl on a Debian Linux server with"
......@@ -66,7 +86,7 @@ if [ "$(find /etc/apt/sources.list.d/ -mindepth 1 -maxdepth 1 -type f -name 'sym
fi
echo -n "Adding repository to apt..."
echo "deb http://packages.mythic-beasts.com/mythic/ $version main" > "/etc/apt/sources.list.d/sympl_$version.list"
echo "deb http://packages.mythic-beasts.com/mythic/ $version main" > "/etc/apt/sources.list.d/sympl_$codename.list"
echo "OK"
echo -n "Updating apt..."
......@@ -74,22 +94,26 @@ apt-get -qq update
echo "OK"
echo "Installing Sympl..."
echo "Starting in 5 seconds - Ctrl-C to cancel!"
sleep 5
if [ $noninteractive == 0 ]; then
echo "Starting in 5 seconds - Ctrl-C to cancel!"
sleep 5
fi
apt-get -y install --install-recommends sympl-core
if [ $? != 0 ]; then
echo "Something went wrong. Exiting."
exit 0
exit 1
fi
clear
echo -n "Thanks for installing..."
/etc/update-motd.d/00-sympl-banner
if [ $noninteractive == 0 ]; then
clear
echo -n "Thanks for installing..."
/etc/update-motd.d/00-sympl-banner
read -n1 -p 'Press any key for important information...'
read -n1 -p 'Press any key for important information...'
echo "
echo "
Important Information - Read This Now!
......@@ -116,10 +140,12 @@ echo "
"
read -n1 -p 'Press any key to set the new password...'
read -n1 -p 'Press any key to set the new password...'
echo
echo "Setting new password for user 'sympl':"
passwd sympl
echo
echo "Setting new password for user 'sympl':"
passwd sympl
fi
echo "Done!"
echo "Sympl install completed!"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment