Skip to content

Commit fbacb2e

Browse files
author
Brian Pontarelli
committed
Fixing bugs
1 parent fd5eab5 commit fbacb2e

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

setup-existing-server.sh

100644100755
File mode changed.

setup-new-server.sh

100644100755
+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env bash
22

3+
function bail {
4+
echo "************** ${1} **************"
5+
exit 1
6+
}
7+
38
if [[ ${#} != 4 && ${#} != 5 ]]; then
49
echo "Usage: setup-new-server.sh <root@host> <ssh-public-key-file> <iptable-config-file> <ordinary-username> [ordinary-user-password]"
510
echo ""
@@ -9,22 +14,23 @@ if [[ ${#} != 4 && ${#} != 5 ]]; then
914
exit 1
1015
fi
1116

12-
1317
root_at_host=$1
1418
ssh_key_file=$2
1519
iptable_cfg_file=$3
1620
ordinary_user=$4
1721

1822
ordinary_user_password=""
19-
ordinary_user_password_confirm=""
23+
ordinary_user_password_confirm="other"
2024
if [[ ${#} == 5 ]]; then
2125
ordinary_user_password=$5
2226
else
2327
while [[ ${ordinary_user_password} != ${ordinary_user_password_confirm} ]]; do
2428
echo -n "Password: "
2529
read -s ordinary_user_password
30+
echo ""
2631
echo -n "Password (again): "
2732
read -s ordinary_user_password_confirm
33+
echo ""
2834
if [[ ${ordinary_user_password} != ${ordinary_user_password_confirm} ]]; then
2935
echo "Passwords don't match"
3036
fi
@@ -40,4 +46,4 @@ if ! [ -f ${iptable_cfg_file} ]; then
4046
fi
4147

4248
scp output/* ${ssh_key_file} ${root_at_host}:/root
43-
ssh -t ${root_at_host} "/root/setup-new-server.sh ${ssh_key_file} ${iptable_cfg_file} ${ordinary_user} ${ordinary_user_password}"
49+
ssh -t ${root_at_host} "/root/setup-server.sh ${ssh_key_file} ${iptable_cfg_file} '${ordinary_user}' '${ordinary_user_password}'"

template/ubuntu-16.04/setup-server.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#!/usr/bin/env bash
22

3+
function bail {
4+
echo "************** ${1} **************"
5+
exit 1
6+
}
7+
38
if [[ ${#} != 4 ]]; then
4-
echo "Usage: setup-server.sh <ssh-public-key-file> <iptable-config-file> <ordinary-username> <ordinar-user-password>"
9+
echo "Usage: setup-server.sh <ssh-public-key-file> <iptable-config-file> <ordinary-username> <ordinary-user-password>"
510
echo ""
611
echo " for example: setup-server.sh id_rsa.pub iptables-application-server.cfg myuser password"
712
exit 1

0 commit comments

Comments
 (0)