-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspinup.sh
57 lines (39 loc) · 1.08 KB
/
spinup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
URL=$1
PDC=$2
Domain=$3
Username=$4
Password=$5
ServerAdmin=$6
# Function to display script usage
function quit {
echo "Usage: $0 {URL to the init setup script repo} {Name of the PDC} {Domain you wanted to join} {Username to join the domain} {Password} {Name of the server admin group}"
exit 1
}
# Exist script if not all necessary argument is present
if [ -z "$URL" ] || [ -z "$PDC" ] || [ -z "$Domain" ] || [ -z "$Username" ] || [ -z "$Password" ] || [ -z "$ServerAdmin" ]
then
quit
fi
workdir="/root/script"
# CD into the working directory
cd $workdir
# Get the startup script from repo
wget $URL
# Unzip it and capture the folder name
mkdir tmpunzip
unzip -d tmpunzip *.zip
foldercreated=$(basename tmpunzip/*)
mv tmpunzip/$foldercreated $foldercreated
rm -rf tmpunzip
# CD into the startup script folder
cd $foldercreated
# make all the script executable
chmod +x *.sh *.exp
chmod +x role/*.sh
chmod +x config/*.sh
# run the script (and pass all the argument)
./initsetup.sh $PDC $Domain $Username $Password $ServerAdmin
# clean up the .zip file
cd $workdir
rm *.zip