mirror of https://github.com/tteck/Proxmox.git
				
				
				
			Compare commits
	
		
			7 Commits
		
	
	
		
			35f5b8413d
			...
			a7a1c1717c
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						a7a1c1717c | |
| 
							
							
								 | 
						fb08167a83 | |
| 
							
							
								 | 
						1f32020d5c | |
| 
							
							
								 | 
						8e6f6dc282 | |
| 
							
							
								 | 
						bdc8d02f06 | |
| 
							
							
								 | 
						2e58146380 | |
| 
							
							
								 | 
						6829e1121d | 
| 
						 | 
				
			
			@ -31,7 +31,7 @@ catch_errors
 | 
			
		|||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW="-password alpine"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ catch_errors
 | 
			
		|||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW="-password alpine"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
 | 
			
		||||
# Copyright (c) 2021-2023 tteck
 | 
			
		||||
# Author: tteck (tteckster)
 | 
			
		||||
# License: MIT
 | 
			
		||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
 | 
			
		||||
 | 
			
		||||
function header_info {
 | 
			
		||||
  clear
 | 
			
		||||
  cat <<"EOF"
 | 
			
		||||
    ___________ ____  __  __                   
 | 
			
		||||
   / ____/ ___// __ \/ / / /___  ____ ___  ___ 
 | 
			
		||||
  / __/  \__ \/ /_/ / /_/ / __ \/ __ `__ \/ _ \
 | 
			
		||||
 / /___ ___/ / ____/ __  / /_/ / / / / / /  __/
 | 
			
		||||
/_____//____/_/   /_/ /_/\____/_/ /_/ /_/\___/ 
 | 
			
		||||
 Alpine                                               
 | 
			
		||||
 | 
			
		||||
EOF
 | 
			
		||||
}
 | 
			
		||||
header_info
 | 
			
		||||
echo -e "Loading..."
 | 
			
		||||
APP="Alpine-ESPHome"
 | 
			
		||||
var_disk="2"
 | 
			
		||||
var_cpu="1"
 | 
			
		||||
var_ram="512"
 | 
			
		||||
var_os="alpine"
 | 
			
		||||
var_version="3.17"
 | 
			
		||||
variables
 | 
			
		||||
color
 | 
			
		||||
catch_errors
 | 
			
		||||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
  CORE_COUNT="$var_cpu"
 | 
			
		||||
  RAM_SIZE="$var_ram"
 | 
			
		||||
  BRG="vmbr0"
 | 
			
		||||
  NET=dhcp
 | 
			
		||||
  GATE=""
 | 
			
		||||
  DISABLEIP6="no"
 | 
			
		||||
  MTU=""
 | 
			
		||||
  SD=""
 | 
			
		||||
  NS=""
 | 
			
		||||
  MAC=""
 | 
			
		||||
  VLAN=""
 | 
			
		||||
  SSH="no"
 | 
			
		||||
  VERB="no"
 | 
			
		||||
  echo_default
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function update_script() {
 | 
			
		||||
  if [[ ! -f /usr/bin/esphome ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
			
		||||
  while true; do
 | 
			
		||||
    CHOICE=$(
 | 
			
		||||
      whiptail --title "SUPPORT" --menu "Select option" 11 58 1 \
 | 
			
		||||
        "1" "Check for ESPHome Updates" 3>&2 2>&1 1>&3
 | 
			
		||||
    )
 | 
			
		||||
    exit_status=$?
 | 
			
		||||
    if [ $exit_status == 1 ]; then
 | 
			
		||||
      clear
 | 
			
		||||
      exit-script
 | 
			
		||||
    fi
 | 
			
		||||
    header_info
 | 
			
		||||
    case $CHOICE in
 | 
			
		||||
    1)
 | 
			
		||||
      esphome stop
 | 
			
		||||
      pip3 install esphome --upgrade
 | 
			
		||||
      esphome start
 | 
			
		||||
      exit
 | 
			
		||||
      ;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
start
 | 
			
		||||
build_container
 | 
			
		||||
description
 | 
			
		||||
 | 
			
		||||
msg_ok "Completed Successfully!\n"
 | 
			
		||||
echo -e "${APP} should be reachable by going to the following URL.
 | 
			
		||||
         ${BL}http://${IP}:6052${CL} \n"
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ catch_errors
 | 
			
		|||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW="-password alpine"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ catch_errors
 | 
			
		|||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW="-password alpine"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ catch_errors
 | 
			
		|||
 | 
			
		||||
function default_settings() {
 | 
			
		||||
  CT_TYPE="1"
 | 
			
		||||
  PW="-password alpine"
 | 
			
		||||
  PW=""
 | 
			
		||||
  CT_ID=$NEXTID
 | 
			
		||||
  HN=$NSAPP
 | 
			
		||||
  DISK_SIZE="$var_disk"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ function default_settings() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
function update_script() {
 | 
			
		||||
  [[ ! -f /etc/systemd/system/homeassistant.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
			
		||||
  if [[ ! -f /etc/systemd/system/homeassistant.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
			
		||||
  UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
 | 
			
		||||
  "1" "Update Podman" ON \
 | 
			
		||||
  "2" "Install HACS" OFF \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@ $STD rm AdGuardHome_linux_amd64.tar.gz
 | 
			
		|||
$STD chmod +x /opt/AdGuardHome/AdGuardHome
 | 
			
		||||
$STD /opt/AdGuardHome/AdGuardHome -s install
 | 
			
		||||
$STD /opt/AdGuardHome/AdGuardHome -s start
 | 
			
		||||
$STD msg_ok "Installed Alpine-AdGuard"
 | 
			
		||||
msg_ok "Installed Alpine-AdGuard"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,3 +59,4 @@ if echo "$prompt" | grep -Eq "^(y|yes)$"; then
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
# Copyright (c) 2021-2023 tteck
 | 
			
		||||
# Author: tteck (tteckster)
 | 
			
		||||
# License: MIT
 | 
			
		||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
 | 
			
		||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
 | 
			
		||||
 | 
			
		||||
color
 | 
			
		||||
verb_ip6
 | 
			
		||||
catch_errors
 | 
			
		||||
setting_up_container
 | 
			
		||||
network_check
 | 
			
		||||
update_os
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Dependencies"
 | 
			
		||||
$STD apk add newt
 | 
			
		||||
$STD apk add curl
 | 
			
		||||
$STD apk add openssh
 | 
			
		||||
$STD apk add nano
 | 
			
		||||
$STD apk add mc
 | 
			
		||||
$STD apk add git
 | 
			
		||||
msg_ok "Installed Dependencies"
 | 
			
		||||
 | 
			
		||||
msg_info "Installing Alpine-ESPHome"
 | 
			
		||||
$STD apk add py3-pip
 | 
			
		||||
$STD pip3 install esphome
 | 
			
		||||
$STD pip3 install tornado esptool
 | 
			
		||||
cat <<EOF >/etc/init.d/esphome
 | 
			
		||||
#!/sbin/openrc-run
 | 
			
		||||
 | 
			
		||||
name="esphome"
 | 
			
		||||
description="ESPHome Service"
 | 
			
		||||
command="/usr/bin/esphome /root/config/ dashboard"
 | 
			
		||||
pidfile="/run/$RC_SVCNAME/pid"
 | 
			
		||||
 | 
			
		||||
depend() {
 | 
			
		||||
    need net
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
start_pre() {
 | 
			
		||||
    checkpath --directory --mode 0755 /run/$RC_SVCNAME
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
start() {
 | 
			
		||||
    ebegin "Starting $description"
 | 
			
		||||
    start-stop-daemon --start --quiet --exec $command
 | 
			
		||||
    eend $?
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
stop() {
 | 
			
		||||
    ebegin "Stopping $description"
 | 
			
		||||
    start-stop-daemon --stop --quiet --exec $command
 | 
			
		||||
    eend $?
 | 
			
		||||
}
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
chmod 755 /etc/init.d/esphome
 | 
			
		||||
/etc/init.d/esphome start
 | 
			
		||||
rc-update add esphome default
 | 
			
		||||
msg_ok "Installed Alpine-ESPHome"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			@ -29,3 +29,4 @@ $STD rc-update add grafana default
 | 
			
		|||
msg_ok "Installed Grafana"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			@ -36,3 +36,4 @@ $STD rc-update add vaultwarden default
 | 
			
		|||
msg_ok "Installed Alpine-Vaultwarden"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			@ -26,3 +26,4 @@ $STD apk add zigbee2mqtt
 | 
			
		|||
msg_ok "Installed Alpine-Zigbee2MQTT"
 | 
			
		||||
 | 
			
		||||
motd_ssh
 | 
			
		||||
root
 | 
			
		||||
| 
						 | 
				
			
			@ -114,3 +114,15 @@ motd_ssh() {
 | 
			
		|||
    $STD /etc/init.d/sshd start
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
customize() {
 | 
			
		||||
  msg_info "Customizing Container"
 | 
			
		||||
  bash -c "passwd -d root" >/dev/null 2>&1
 | 
			
		||||
  msg_ok "Customized Container"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
root() {
 | 
			
		||||
  if ! getent shadow root | grep -q '^root:[^:]*:\?\$'; then
 | 
			
		||||
    customize
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -452,6 +452,7 @@ EOF
 | 
			
		|||
  pct start "$CTID"
 | 
			
		||||
  msg_ok "Started LXC Container"
 | 
			
		||||
  if [ "$var_os" == "alpine" ]; then
 | 
			
		||||
  sleep 5
 | 
			
		||||
  pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
 | 
			
		||||
  fi
 | 
			
		||||
  lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$var_install.sh)" || exit
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue