mirror of https://github.com/tteck/Proxmox.git
				
				
				
			indentation
This commit is contained in:
		
							parent
							
								
									602d4496f8
								
							
						
					
					
						commit
						38381bb6ef
					
				| 
						 | 
				
			
			@ -16,9 +16,15 @@ color() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
verb_ip6() {
 | 
			
		||||
  if [ "$VERBOSE" = "yes" ]; then set -x; 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
 | 
			
		||||
  if [ "$VERBOSE" = "yes" ]; then
 | 
			
		||||
    set -x
 | 
			
		||||
    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() {
 | 
			
		||||
| 
						 | 
				
			
			@ -51,21 +57,21 @@ msg_error() {
 | 
			
		|||
 | 
			
		||||
setting_up_container() {
 | 
			
		||||
  msg_info "Setting up Container OS"
 | 
			
		||||
while [ $i -gt 0 ]; do
 | 
			
		||||
  if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then
 | 
			
		||||
    break
 | 
			
		||||
  fi
 | 
			
		||||
  echo 1>&2 -en "${CROSS}${RD} No Network! "
 | 
			
		||||
  sleep $RETRY_EVERY
 | 
			
		||||
  i=$((i-1))
 | 
			
		||||
done
 | 
			
		||||
  while [ $i -gt 0 ]; do
 | 
			
		||||
    if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" != "" ]; then
 | 
			
		||||
      break
 | 
			
		||||
    fi
 | 
			
		||||
    echo 1>&2 -en "${CROSS}${RD} No Network! "
 | 
			
		||||
    sleep $RETRY_EVERY
 | 
			
		||||
    i=$((i - 1))
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" = "" ]; then
 | 
			
		||||
  echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
 | 
			
		||||
  echo -e " 🖧  Check Network Settings"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
cat <<EOF >/etc/apk/repositories
 | 
			
		||||
  if [ "$(ip addr show | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | cut -d'/' -f1)" = "" ]; then
 | 
			
		||||
    echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
 | 
			
		||||
    echo -e " 🖧  Check Network Settings"
 | 
			
		||||
    exit 1
 | 
			
		||||
  fi
 | 
			
		||||
  cat <<EOF >/etc/apk/repositories
 | 
			
		||||
https://dl-cdn.alpinelinux.org/alpine/edge/main
 | 
			
		||||
https://dl-cdn.alpinelinux.org/alpine/edge/community
 | 
			
		||||
https://dl-cdn.alpinelinux.org/alpine/edge/testing
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +83,7 @@ EOF
 | 
			
		|||
network_check() {
 | 
			
		||||
  set +e
 | 
			
		||||
  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"
 | 
			
		||||
    read -r -p "Would you like to continue anyway? <y/N> " prompt
 | 
			
		||||
    if echo "$prompt" | grep -Eq "^(y|yes)$"; then
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +107,10 @@ update_os() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
motd_ssh() {
 | 
			
		||||
echo "export TERM='xterm-256color'" >>/root/.bashrc
 | 
			
		||||
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" > /etc/motd
 | 
			
		||||
if [[ "${SSH_ROOT}" == "yes" ]]; then $STD rc-update add sshd; $STD /etc/init.d/sshd start; fi
 | 
			
		||||
}
 | 
			
		||||
  echo "export TERM='xterm-256color'" >>/root/.bashrc
 | 
			
		||||
  echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd
 | 
			
		||||
  if [[ "${SSH_ROOT}" == "yes" ]]; then
 | 
			
		||||
    $STD rc-update add sshd
 | 
			
		||||
    $STD /etc/init.d/sshd start
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,9 +15,15 @@ color() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
verb_ip6() {
 | 
			
		||||
  if [ "$VERBOSE" = "yes" ]; then set -x; 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
 | 
			
		||||
  if [ "$VERBOSE" = "yes" ]; then
 | 
			
		||||
    set -x
 | 
			
		||||
    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() {
 | 
			
		||||
| 
						 | 
				
			
			@ -52,14 +58,14 @@ setting_up_container() {
 | 
			
		|||
  msg_info "Setting up Container OS"
 | 
			
		||||
  sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 | 
			
		||||
  locale-gen >/dev/null
 | 
			
		||||
  echo $tz > /etc/timezone
 | 
			
		||||
  echo $tz >/etc/timezone
 | 
			
		||||
  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
 | 
			
		||||
      break
 | 
			
		||||
    fi
 | 
			
		||||
  echo 1>&2 -en "${CROSS}${RD} No Network! "
 | 
			
		||||
  sleep $RETRY_EVERY
 | 
			
		||||
    echo 1>&2 -en "${CROSS}${RD} No Network! "
 | 
			
		||||
    sleep $RETRY_EVERY
 | 
			
		||||
  done
 | 
			
		||||
  if [ "$(hostname -I)" = "" ]; then
 | 
			
		||||
    echo 1>&2 -e "\n${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
 | 
			
		||||
| 
						 | 
				
			
			@ -73,7 +79,7 @@ setting_up_container() {
 | 
			
		|||
network_check() {
 | 
			
		||||
  set +e
 | 
			
		||||
  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"
 | 
			
		||||
    read -r -p "Would you like to continue anyway? <y/N> " prompt
 | 
			
		||||
    if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -97,10 +103,13 @@ update_os() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
motd_ssh() {
 | 
			
		||||
echo "export TERM='xterm-256color'" >>/root/.bashrc
 | 
			
		||||
echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" > /etc/motd
 | 
			
		||||
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
 | 
			
		||||
  echo "export TERM='xterm-256color'" >>/root/.bashrc
 | 
			
		||||
  echo -e "$APPLICATION LXC provided by https://tteck.github.io/Proxmox/\n" >/etc/motd
 | 
			
		||||
  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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
customize() {
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +128,6 @@ EOF
 | 
			
		|||
 | 
			
		||||
root() {
 | 
			
		||||
  if ! getent shadow root | grep -q "^root:[^\!*]"; then
 | 
			
		||||
  customize
 | 
			
		||||
    customize
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue