This repository has been archived by the owner on Feb 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
270794
36 lines (34 loc) · 1.96 KB
/
270794
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
#!/bin/bash
# <UDF name="user_name" label="Unprivileged user account name that will have access to sudo command" example="This is the account that you will be using to log in." />
# <UDF name="user_password" label="Unprivileged user password"/>
# <UDF name="user_sshkey" default="" label="Public Key for User" example="Recommended method of authentication. It is more secure than password log in." />
# <UDF name="user_shell" label="Shell" oneof="/bin/zsh,/bin/bash" default="/bin/bash" />
# <UDF name="sshd_passwordauth" label="Use SSH password authentication" oneof="Yes,No" default="No" example="Turn off password authentication if you have added a Public Key." />
# <UDF name="sshd_permitrootlogin" label="Permit SSH root login" oneof="No,Yes" default="No" example="Root account should not be exposed." />
#
# <UDF name="host_name" label="Hostname" default="mylinodehost" example="mylinodehost or a more unique name" />
# <UDF name="autoexec" label="Automatic execute script" oneof="Yes,No" default="Yes" example="Otherwise manuel exercute script at first login" />
#
IFSOLD=@IFS
APP_DIR=/root/Complete_web_and_mail_server
# if first time run!
if [ ! -d "$APP_DIR" ]; then
mkdir $APP_DIR
wget --no-check-certificate https://api.github.com/repos/debianshellscripts/Complete-web-and-mail-server/tarball/master
tar xpvf master -C $APP_DIR --strip-components=1
IFS=$'\n\t'
CONFIG_TO_FILE[i++]=$(printf 'USER_NAME="%s"' $USER_NAME)
CONFIG_TO_FILE[i++]=$(printf 'USER_PASSWORD="%s"' $USER_PASSWORD)
CONFIG_TO_FILE[i++]=$(printf 'USER_SHELL="%s"' $USER_SHELL)
CONFIG_TO_FILE[i++]=$(printf 'USER_SSHKEY="%s"' $USER_SSHKEY)
CONFIG_TO_FILE[i++]=$(printf 'SSHD_PERMITROOTLOGIN="%s"' $SSHD_PERMITROOTLOGIN)
CONFIG_TO_FILE[i++]=$(printf 'SSHD_PASSWORDAUTH="%s"' $SSHD_PASSWORDAUTH)
CONFIG_TO_FILE[i++]=$(printf 'HOST_NAME="%s"' $HOST_NAME)
printf "%s\n" "${CONFIG_TO_FILE[@]}" >"${APP_DIR}/config.sh"
IFS=$IFSOLD
if [ $AUTOEXEC = "Yes" ]; then
. $APP_DIR/setup.sh
fi
else
. $APP_DIR/setup.sh
fi