@ -15,9 +15,15 @@ color() {
}
}
verb_ip6() {
verb_ip6() {
if [ "$VERBOSE" = "yes" ]; then set -x; STD=""; else STD="silent"; fi
if [ "$VERBOSE" = "yes" ]; then
silent() { "$@" > /dev/null 2>&1; }
set -x
if [ "$DISABLEIPV6" == "yes" ]; then echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf; $STD sysctl -p; fi
STD=""
else STD="silent"; fi
silent() { "$@" >/dev/null 2>&1; }
if [ "$DISABLEIPV6" == "yes" ]; then
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
$STD sysctl -p
fi
}
}
catch_errors() {
catch_errors() {
@ -52,14 +58,14 @@ setting_up_container() {
msg_info "Setting up Container OS"
msg_info "Setting up Container OS"
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
locale-gen >/dev/null
locale-gen >/dev/null
echo $tz > /etc/timezone
echo $tz >/etc/timezone
ln -sf /usr/share/zoneinfo/$tz /etc/localtime
ln -sf /usr/share/zoneinfo/$tz /etc/localtime
for ((i=RETRY_NUM; i>0; i--)); do
for ((i = RETRY_NUM; i > 0; i--)); do
if [ "$(hostname -I)" != "" ]; then
if [ "$(hostname -I)" != "" ]; then
break
break
fi
fi
echo 1>&2 -en "${CROSS}${RD} No Network! "
echo 1>&2 -en "${CROSS}${RD} No Network! "
sleep $RETRY_EVERY
sleep $RETRY_EVERY
done
done
if [ "$(hostname -I)" = "" ]; then
if [ "$(hostname -I)" = "" ]; then
echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
@ -73,7 +79,7 @@ setting_up_container() {
network_check() {
network_check() {
set +e
set +e
trap - ERR
trap - ERR
if ping -c 1 -W 1 1.1.1.1 &> /dev/null; then msg_ok "Internet Connected"; else
if ping -c 1 -W 1 1.1.1.1 &>/dev/null; then msg_ok "Internet Connected"; else
msg_error "Internet NOT Connected"
msg_error "Internet NOT Connected"
read -r -p "Would you like to continue anyway? <y/N> " prompt
read -r -p "Would you like to continue anyway? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
@ -97,10 +103,13 @@ update_os() {
}
}
motd_ssh() {
motd_ssh() {
echo "export TERM='xterm-256color'" >>/root/.bashrc
echo "export TERM='xterm-256color'" >>/root/.bashrc
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" > /etc/motd
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd
chmod -x /etc/update-motd.d/*
chmod -x /etc/update-motd.d/*
if [[ "${SSH_ROOT}" == "yes" ]]; then sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config; systemctl restart sshd; fi
if [[ "${SSH_ROOT}" == "yes" ]]; then
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
systemctl restart sshd
fi
}
}
customize() {
customize() {
@ -119,6 +128,6 @@ EOF
root() {
root() {
if ! getent shadow root | grep -q "^root:[^\!*]"; then
if ! getent shadow root | grep -q "^root:[^\!*]"; then
customize
customize
fi
fi
}
}