Permalink
Browse files

Added description and usage for the scripts, added more documentation…

…, moved MOTD to the finale.sh script.
  • Loading branch information...
1 parent 817f943 commit 7a43fcfefd3d55bd08de69923ee8891de0fa7aa3 Brooke Kuhlmann committed Apr 25, 2012
Showing with 55 additions and 41 deletions.
  1. +10 −5 README.rdoc
  2. +7 −9 scripts/defaults.sh
  3. +13 −0 scripts/finale.sh
  4. +7 −4 scripts/packages.sh
  5. +7 −4 scripts/users.sh
  6. +11 −19 setup.sh
View
@@ -31,6 +31,7 @@ Master Version (unstable):
Edit the setup.sh file and adjust the settings as you see fit, namely the following variables:
+* SERVER_IP
* SERVER_HOSTNAME
* USER_LOGIN
* USER_PASS
@@ -39,11 +40,15 @@ You may want to tweak the *.sh files in the scripts folder as well.
= Usage
-Open a terminal window and execute the following command:
-
- ./setup.sh
-
-Feel free to delete this ubuntu project directory after completing installation.
+1. ssh to your server or VM.
+2. Switch to the root user.
+3. Create the a /root/.ssh/authorized_keys file with your public key.
+4. chmod -R 600 /root/.ssh.
+5. mkdir /root/ubuntu.
+5. scp the files of this project to the /root/ubuntu folder. Example: scp -r * root@10.0.1.50:/root/ubuntu.
+6. Run the /root/ubuntu/setup.sh script in the root of this project.
+7. Delete the /root/ubuntu folder.
+8. Delete the /root/.ssh folder.
= Contributions
View
@@ -1,9 +1,12 @@
-#!/bin/bash
+#!/bin/sh
-#############
-# Execution #
-#############
+# DESCRIPTION
+# Configures server defaults.
+# REQUIREMENTS
+# ../setup.sh
+
+# EXECUTION
echo "Setting hostname..."
echo $SERVER_HOSTNAME > /etc/hostname
hostname -F /etc/hostname
@@ -12,10 +15,5 @@ echo "Updating hosts..."
echo "$SERVER_IP $SERVER_HOSTNAME $SERVER_HOSTNAME" >> /etc/hosts
hostname -f
-echo "Setting the message of the day..."
-echo "Welcome to the $SERVER_HOSTNAME server!" > /etc/motd.tail
-echo "#!/bin/sh" > /etc/update-motd.d/00-header
-rm -f /etc/update-motd.d/10-help-text
-
echo "Setting UTC timezone..."
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
View
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# DESCRIPTION
+# Configures final server settings (or those which must be set last).
+
+# REQUIREMENTS
+# ../setup.sh
+
+# EXECUTION
+echo "Setting the message of the day..."
+echo "Welcome to the $SERVER_HOSTNAME server." > /etc/motd.tail
+echo '' > /etc/update-motd.d/00-header
+echo '' > /etc/update-motd.d/10-help-text
View
@@ -1,9 +1,12 @@
-#!/bin/bash
+#!/bin/sh
-#############
-# Execution #
-#############
+# DESCRIPTION
+# Installs default packages.
+# REQUIREMENTS
+# ../setup.sh
+
+# EXECUTION
# Initialization
$INSTALL_COMMAND update
$INSTALL_COMMAND upgrade
View
@@ -1,9 +1,12 @@
-#!/bin/bash
+#!/bin/sh
-#############
-# Execution #
-#############
+# DESCRIPTION
+# Configures default user(s).
+# REQUIREMENTS
+# ../setup.sh
+
+# EXECUTION
# Create user account.
useradd -m -s /bin/bash -G admin $USER_LOGIN
usermod -p $(echo $USER_PASS | openssl passwd -1 -stdin) $USER_LOGIN
View
@@ -1,16 +1,12 @@
-#!/bin/bash
+#!/bin/sh
-################
-# Instructions #
-################
+# DESCRIPTION
+# One script to rule them all - Executes all setup scripts.
-# Description: Executes all setup scripts.
-# Usage: ./setup.sh
-
-############
-# Settings #
-############
+# USAGE
+# ./setup.sh
+# SETTINGS
set -u # Exit if any variables are uninitialised.
set -e # Exit if any command returns non-zero.
export SERVER_IP=127.0.1.1 # Placeholder for server IP.
@@ -19,15 +15,8 @@ export USER_LOGIN=app # The master user for automated tasks, deployments, app ma
export USER_PASS=password # The master user password.
export INSTALL_COMMAND="apt-get -q -y"
-#############
-# Execution #
-#############
-
-echo "Configuring server..."
-if [[ $EUID -ne 0 ]]; then
- echo "This script must be run as root" 1>&2
- exit 1
-fi
+# EXECUTION
+echo "Setup starting..."
echo "Configuring defaults..."
scripts/defaults.sh
@@ -38,6 +27,9 @@ scripts/packages.sh
echo "Configuring users..."
scripts/users.sh
+echo "Finalizing setup..."
+scripts/finale.sh
+
echo "Rebooting the server..."
shutdown -r now

0 comments on commit 7a43fcf

Please sign in to comment.