diff --git a/README.md b/README.md
index 91da5a8..0da883c 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,14 @@
-```
- ____
- / __ \_________ _ ______ ___ ____ _ __
- / /_/ / ___/ __ \| |/_/ __ `__ \/ __ \| |/_/
- / ____/ / / /_/ /> / / / / / /_/ /> <
- /_/ /_/ \____/_/|_/_/ /_/ /_/\____/_/|_|
- __ __ __ __
- / / / /___ ____/ /___ _/ /____ ____
- / / / / __ \/ __ / __ `/ __/ _ \/ __/
- / /_/ / /_/ / /_/ / /_/ / /_/ __/ /
- \____/ .___/\____/\____/\__/\___/_/
- /_/
-```
+![Logo](https://github.com/BassT23/Proxmox/assets/30832786/00fa746d-3d65-4b01-8906-50ecb845a50d)
+
![Screenshot_20230326_130709](https://user-images.githubusercontent.com/30832786/227771669-aae7e7f4-b27e-4095-950a-c6fa1f146503.png)
[![GitHub release](https://img.shields.io/github/release/BassT23/Proxmox.svg)](https://GitHub.com/BassT23/Proxmox/releases/)
[![GitHub stars](https://img.shields.io/github/stars/BassT23/Proxmox.svg)](https://github.com/BassT23/Proxmox/stargazers)
[![downloads](https://img.shields.io/github/downloads/BassT23/Proxmox/total.svg)](https://github.com/BassT23/Proxmox/releases)
+[![Discord](https://img.shields.io/discord/1149671790864506882)](https://discord.gg/nVpUg6BKn8)
+
Proxmox® is a registered trademark of Proxmox Server Solutions GmbH.
@@ -42,7 +33,7 @@ I am no member of the Proxmox Server Solutions GmbH. This is not an official pro
### Features:
- Update Proxmox VE (the host / all cluster nodes / all included LXCs and VMs)
- Normal run is "Interactive" / Headless Mode can be run with `update -s`
-- Logging
+- Logging to ``/var/log/update-"$HOSTNAME".log``
- Exit tracking, so you can send additional commands for finish or failure (edit files in `/root/Proxmox-Updater/exit`)
- [Config file](https://github.com/BassT23/Proxmox#config-file)
@@ -53,7 +44,8 @@ Changelog: [here](https://github.com/BassT23/Proxmox/blob/beta/change.log)
### What does the script do:
- The script make system updates with apt/dnf/pacman/apk or yum on all nodes/LXCs and VMs (if VMs prepared for that)
-- After that it makes an little cleaning (like `apt autoremove`)
+- Before the LXC/VM update start, there could be make a backup. This could be enabled in `update.conf`
+- After all, the updater makes an little cleaning (like `apt autoremove`)
- If the script detects "extra" installations, it could update this also. (look in config file, for this)
##
@@ -91,7 +83,7 @@ So connect from first node (on which you install the Proxmox-Updater) to node2 w
2. Use ssh connection with Key-Based Authentication (a little more work, but nicer output and "extra" support)
- more infos here: [SSH Connection](https://github.com/BassT23/Proxmox/blob/development/ssh.md)
+ more infos here: [SSH Connection](https://github.com/BassT23/Proxmox/blob/develop/ssh.md)
# Update the script:
@@ -150,4 +142,4 @@ To go back to master, choose `update -up`
[![grafik](https://user-images.githubusercontent.com/30832786/227482640-e7800e89-32a6-44fc-ad3b-43eef5cdc4d4.png)](https://ko-fi.com/basst)
# Credits:
-[@Uruk](https://github.com/Uruknara) - for help with the code
+[@Uruk](https://github.com/Uruknara) / [@elbim](https://github.com/elbim)
diff --git a/change.log b/change.log
index 88e914c..dcea56f 100644
--- a/change.log
+++ b/change.log
@@ -1,8 +1,16 @@
Changelog:
==========
-**v3.8.5** (beta)
-
+**v3.9** (07.11.2023)
+- make backup before update (must be enabled in config by user)
+- code cleaning
+- check internet connection on each LXC/VM
+- config file:
+ - check for updates on excluded
+ - include phased updates
+- make snapshot from LXC/VM before update (thanks to @elbim)
+
+**v3.8.5** (18.06.2023)
- Skip node, if not reachable
- check internet status
- will always use master version
@@ -10,14 +18,12 @@ Changelog:
- fix version info
**v3.8.4** (01.04.2023)
-
- Speed up start in cluster mode
- Speed up installation
- Bug fixing
- Code cleaning
**v3.8** (28.03.2023)
-
- Add SSH Connection for VM - with extra update support
- Add "Global Extra" in config file, for disable/enable Extra Updates
- Info, if you are on beta/development version
@@ -31,7 +37,6 @@ Changelog:
- Add "reboot required"
**v3.7** (09.03.2023)
-
- Fixing code
- Support "only" LXC/VM
- Fix docker-compose update
@@ -40,64 +45,51 @@ Changelog:
- Need neofetch (will install automatic)
**v3.6** (22.02.2023)
-
- Add config file
- Cleaning code
- More colorful
- Fixing logging
**v3.4** (not released)
-
- Add VM Update
- Cleaning code
- Fixed Docker Update
**v3.3** (15.02.2023)
-
- Add Update Info
- Add extra Updates
- Add version check by user
**v3.1.1** (13.02.2023)
-
- Fixed update failure with CentOS
**v3.1** (12.02.2023)
-
- Add better usage
- Cleanup overall code
**v3.0** (10.02.2023)
-
- Implement single install url
**v2.8** (09.02.2023)
-
- Cleanup overall code
**v2.7.1** (06.02.2023)
-
- Small fixes
**v2.7** (31.01.2023)
-
- Add root check
- Cleanup overall code
**v2.6** (30.01.2023)
-
- Cleanup overall code
- Fix promt of update
- Add updating package that been kept back
**v2.5** (30.01.2023)
-
- Added "Headless Mode" as option with `update -3` otherwise runs in "Interactive Mode"
**v2.4** (29.01.2023)
-
- Visual and Name changes
**v2.3** (29.01.2023)
-
- Update script itself with `update -u`
diff --git a/check-updates.sh b/check-updates.sh
index 0fe0cab..9b87f95 100644
--- a/check-updates.sh
+++ b/check-updates.sh
@@ -4,7 +4,7 @@
# Check Updates #
#################
-VERSION="1.4.4"
+VERSION="1.4.6"
#Variable / Function
CONFIG_FILE="/root/Proxmox-Updater/update.conf"
@@ -80,8 +80,10 @@ READ_WRITE_CONFIG () {
WITH_VM=$(awk -F'"' '/^WITH_VM=/ {print $2}' $CONFIG_FILE)
RUNNING=$(awk -F'"' '/^RUNNING_CONTAINER=/ {print $2}' $CONFIG_FILE)
STOPPED=$(awk -F'"' '/^STOPPED_CONTAINER=/ {print $2}' $CONFIG_FILE)
- EXCLUDED=$(awk -F'"' '/^EXCLUDE=/ {print $2}' $CONFIG_FILE)
- ONLY=$(awk -F'"' '/^ONLY=/ {print $2}' $CONFIG_FILE)
+# EXCLUDED=$(awk -F'"' '/^EXCLUDE=/ {print $2}' $CONFIG_FILE)
+# ONLY=$(awk -F'"' '/^ONLY=/ {print $2}' $CONFIG_FILE)
+ EXCLUDED=$(awk -F'"' '/^EXCLUDE_UPDATE_CHECK=/ {print $2}' $CONFIG_FILE)
+ ONLY=$(awk -F'"' '/^ONLY_UPDATE_CHECK=/ {print $2}' $CONFIG_FILE)
}
## HOST ##
@@ -359,8 +361,7 @@ else
fi
# Run
-wget -q --spider http://google.com
-if [ $? -eq 0 ]; then
+if [[ "$(wget -q --spider http://google.com)" -eq 0 ]]; then
READ_WRITE_CONFIG
ARGUMENTS "$@"
else
diff --git a/install.sh b/install.sh
index fb51f77..3396464 100644
--- a/install.sh
+++ b/install.sh
@@ -4,7 +4,7 @@
# Install #
###########
-VERSION="1.6.6"
+VERSION="1.6.7"
# Branch
BRANCH="master"
@@ -132,7 +132,7 @@ INSTALL () {
echo -e "\n${BL}[Info]${GN} Installing Proxmox-Updater${CL}\n"
if [ -f "/usr/local/bin/update" ]; then
echo -e "${OR}Proxmox-Updater is already installed.${CL}"
- read -p "Should I update for you? Type [Y/y] or Enter for yes - enything else will exit" -n 1 -r -s
+ read -p "Should I update for you? Type [Y/y] or Enter for yes - anything else will exit" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
bash <(curl -s $SERVER_URL/install.sh) update
else
@@ -159,7 +159,7 @@ INSTALL () {
echo -e "${OR}Finished. Run Proxmox-Updater with 'update'.${CL}"
echo -e "For infos and warnings please check the readme under \n"
echo -e "${OR}Also want to install the Welcome-Screen?${CL}\n\
-Type [Y/y] or Enter for yes - enything else will exit"
+Type [Y/y] or Enter for yes - anything else will exit"
read -p "" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
WELCOME_SCREEN_INSTALL
@@ -175,7 +175,7 @@ UPDATE () {
echo -e "${RD}Proxmox-Updater has changed directorys, so the old directory\n\
/root/Update-Scripts will be delete.${CL}\n\
${OR}Is it OK for you, or want to backup your files first?${CL}\n"
- read -p "Type [Y/y] for DELETE - enything else will exit " -n 1 -r -s
+ read -p "Type [Y/y] for DELETE - anything else will exit " -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf /root/Update-Proxmox-Scripts || true
bash <(curl -s $SERVER_URL/install.sh) update
@@ -191,8 +191,8 @@ ${OR}Is it OK for you, or want to backup your files first?${CL}\n"
curl -s https://api.github.com/repos/BassT23/Proxmox/releases/latest | grep "browser_download_url" | cut -d : -f 2,3 | tr -d \" | wget -i - -q -O /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz
elif [[ "$BRANCH" == beta ]]; then
curl -s -L https://github.com/BassT23/Proxmox/tarball/beta > /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz
- elif [[ "$BRANCH" == development ]]; then
- curl -s -L https://github.com/BassT23/Proxmox/tarball/development > /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz
+ elif [[ "$BRANCH" == develop ]]; then
+ curl -s -L https://github.com/BassT23/Proxmox/tarball/develop > /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz
fi
tar -zxf /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz -C /root/Proxmox-Updater-Temp
rm -rf /root/Proxmox-Updater-Temp/Proxmox-Updater.tar.gz || true
@@ -239,7 +239,7 @@ ${OR}Is it OK for you, or want to backup your files first?${CL}\n"
else
# Install, because no installation found
echo -e "${RD}Proxmox-Updater is not installed.\n\n${OR}Would you like to install it?${CL}"
- read -p "Type [Y/y] or Enter for yes - enything else will exit" -n 1 -r -s
+ read -p "Type [Y/y] or Enter for yes - anything else will exit" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
bash <(curl -s $SERVER_URL/install.sh)
else
@@ -257,7 +257,7 @@ CHECK_DIFF () {
Y or y : install the package maintainer's version (old file will be save as '$f.bak')\n \
N or n : keep your currently-installed version\n \
S or s : show the differences between the versions\n \
- The default action is to keep your current version.\n \
+ The default action is to install new version and backup current file.\n \
*** $f (Y/y/N/n/S/s) [default=Y] ? "
read -p "" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
@@ -283,13 +283,13 @@ WELCOME_SCREEN () {
curl -s $SERVER_URL/check-updates.sh > /root/Proxmox-Updater-Temp/check-updates.sh
if ! [[ -f "/etc/update-motd.d/01-welcome-screen" && -x "/etc/update-motd.d/01-welcome-screen" ]]; then
echo -e "${OR} Welcome-Screen is not installed${CL}\n"
- read -p "Would you like to install it also? Type [Y/y] or Enter for yes - enything else will skip" -n 1 -r -s && echo
+ read -p "Would you like to install it also? Type [Y/y] or Enter for yes - anything else will skip" -n 1 -r -s && echo
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
WELCOME_SCREEN_INSTALL
fi
else
echo -e "${OR} Welcome-Screen is already installed${CL}\n"
- read -p "Would you like to uninstall it? Type [Y/y] for yes - enything else will skip" -n 1 -r -s && echo
+ read -p "Would you like to uninstall it? Type [Y/y] for yes - anything else will skip" -n 1 -r -s && echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -rf /etc/update-motd.d/01-welcome-screen || true
rm -rf /etc/motd || true
@@ -326,7 +326,7 @@ UNINSTALL () {
if [ -f /usr/local/bin/update ]; then
echo -e "\n${BL}[Info]${GN} Uninstall Proxmox-Updater${CL}\n"
echo -e "${RD}Really want to remove Proxmox-Updater?${CL}\n\
-Type [Y/y] for yes - enything else will exit"
+Type [Y/y] for yes - anything else will exit"
read -p "" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm /usr/local/bin/update
diff --git a/update-extras.sh b/update-extras.sh
index 9c6dfaa..767dca9 100644
--- a/update-extras.sh
+++ b/update-extras.sh
@@ -4,7 +4,7 @@
# Update-Extras #
#################
-VERSION="1.8.1"
+VERSION="1.8.2"
# Variables
CONFIG_FILE="/root/Proxmox-Updater/update.conf"
@@ -27,12 +27,12 @@ if [[ -d "/opt/iobroker" && $IOBROKER == true ]]; then
echo "*** Update/Upgrade ioBroker ***" && iob update && iob upgrade -y && iob upgrade self -y && echo
echo "*** Start ioBroker ***" && iob start && echo
if [[ -d "/opt/iobroker/iobroker-data/radar2.admin" ]]; then
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp-scan`)
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which node`)
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp`)
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which hcitool`)
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which hciconfig`)
- setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which l2ping`)
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which arp-scan)')"
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which node)')"
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which arp)')"
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which hcitool)')"
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which hciconfig)')"
+ setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip "$(eval readlink -f '$(which l2ping)')"
fi
fi
@@ -74,7 +74,7 @@ if [[ -d "/root/OctoPrint" && $OCTOPRINT == true ]]; then
echo -e "\n*** Updating Octoprint ***\n"
# find octoprint
OPRINT=$(find /home -name "oprint")
- "$OPRINT"/bin/pip install -U octoprint
+ "$OPRINT"/bin/pip install -U --ignore-installed octoprint
sudo service octoprint restart
fi
diff --git a/update.conf b/update.conf
index 5acd31b..18e1cad 100644
--- a/update.conf
+++ b/update.conf
@@ -5,9 +5,9 @@
# change 'true' or commend out with '#' #
################################################
-VERSION="1.2"
-
+VERSION="1.3.1"
VERSION_CHECK="true"
+URL_FOR_INTERNET_CHECK="google.com"
################################################
# Host / LXC / VM #
@@ -20,6 +20,17 @@ WITH_VM="true"
STOPPED_CONTAINER="true"
RUNNING_CONTAINER="true"
+INCLUDE_KERNEL="true"
+INCLUDE_PHASED_UPDATES="false"
+
+################################################
+#This would need much more time for the script!#
+# Better make Backups at night with the UI #
+# change "false" to "true" to enable #
+################################################
+
+BACKUP="false"
+
################################################
# Extra Updates #
################################################
@@ -45,3 +56,13 @@ DOCKER_COMPOSE="true"
ONLY=""
EXCLUDE=""
+
+################################################
+# Update-Checker #
+# Example: ONLY/EXCLUDE="100 110 120" #
+################################################
+# ! If 'ONLY' is set, 'EXCLUDE' don't work ! #
+################################################
+
+ONLY_UPDATE_CHECK=""
+EXCLUDE_UPDATE_CHECK=""
diff --git a/update.sh b/update.sh
index 28e5c31..3d8dcd2 100644
--- a/update.sh
+++ b/update.sh
@@ -4,7 +4,7 @@
# Update #
##########
-VERSION="3.8.5"
+VERSION="3.9"
# Branch
BRANCH="master"
@@ -63,7 +63,7 @@ CHECK_ROOT () {
# Check internet status
CHECK_INTERNET () {
- if ! ping -q -c1 google.com &>/dev/null; then
+ if ! ping -q -c1 "$CHECK_URL" &>/dev/null; then
echo -e "\n${OR} You are offline - Can't update without internet${CL}\n"
exit 2
fi
@@ -146,13 +146,13 @@ ARGUMENTS () {
BRANCH=beta
BRANCH_SET=true
;;
- development)
+ develop)
if [[ "$2" != -up ]]; then
echo -e "\n${OR} Wrong usage! Use branch update like this:${CL}"
echo -e " update beta -up\n"
exit 2
fi
- BRANCH=development
+ BRANCH=develop
BRANCH_SET=true
;;
-up)
@@ -189,7 +189,7 @@ USAGE () {
echo -e " -s --silent Silent / Headless Mode"
echo -e " master Use master branch"
echo -e " beta Use beta branch"
- echo -e " development Use development branch\n"
+ echo -e " develop Use develop branch\n"
echo -e "{COMMAND}:"
echo -e "========="
echo -e " -h --help Show this help"
@@ -209,15 +209,15 @@ VERSION_CHECK () {
SERVER_VERSION=$(awk -F'"' '/^VERSION=/ {print $2}' /root/Proxmox-Updater/temp/update.sh)
if [[ "$BRANCH" == beta ]]; then
echo -e "\n${OR} *** You are on beta branch ***${CL}"
- elif [[ "$BRANCH" == development ]]; then
- echo -e "\n${OR} *** You are on development branch ***${CL}"
+ elif [[ "$BRANCH" == develop ]]; then
+ echo -e "\n${OR} *** You are on develop branch ***${CL}"
fi
if [[ "$SERVER_VERSION" > "$VERSION" ]]; then
echo -e "\n${OR} *** A newer version is available ***${CL}\n\
Installed: $VERSION / Server: $SERVER_VERSION\n"
if [[ "$HEADLESS" != true ]]; then
echo -e "${OR}Want to update Proxmox-Updater first?${CL}"
- read -p "Type [Y/y] or Enter for yes - enything else will skip " -n 1 -r -s
+ read -p "Type [Y/y] or Enter for yes - anything else will skip " -n 1 -r -s
if [[ "$REPLY" =~ ^[Yy]$ || "$REPLY" = "" ]]; then
bash <(curl -s "$SERVER_URL"/install.sh) update
fi
@@ -235,7 +235,7 @@ VERSION_CHECK () {
# Update Proxmox-Updater
UPDATE () {
echo -e "Update to $BRANCH branch?"
- read -p "Type [Y/y] or [Enter] for yes - enything else will exit" -n 1 -r -s
+ read -p "Type [Y/y] or [Enter] for yes - anything else will exit" -n 1 -r -s
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
bash <(curl -s "https://raw.githubusercontent.com/BassT23/Proxmox/$BRANCH"/install.sh) update
else
@@ -247,7 +247,7 @@ UPDATE () {
UNINSTALL () {
echo -e "\n${BL}[Info]${OR} Uninstall Proxmox-Updater${CL}\n"
echo -e "${RD}Really want to remove Proxmox-Updater?${CL}"
- read -p "Type [Y/y] for yes - enything else will exit " -n 1 -r -s
+ read -p "Type [Y/y] for yes - anything else will exit " -n 1 -r -s
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
bash <(curl -s "$SERVER_URL"/install.sh) uninstall
else
@@ -315,17 +315,41 @@ STATUS () {
# Read Config File
READ_CONFIG () {
CHECK_VERSION=$(awk -F'"' '/^VERSION_CHECK=/ {print $2}' "$CONFIG_FILE")
+ CHECK_URL=$(awk -F'"' '/^URL_FOR_INTERNET_CHECK=/ {print $2}' "$CONFIG_FILE")
WITH_HOST=$(awk -F'"' '/^WITH_HOST=/ {print $2}' "$CONFIG_FILE")
WITH_LXC=$(awk -F'"' '/^WITH_LXC=/ {print $2}' "$CONFIG_FILE")
WITH_VM=$(awk -F'"' '/^WITH_VM=/ {print $2}' "$CONFIG_FILE")
RUNNING=$(awk -F'"' '/^RUNNING_CONTAINER=/ {print $2}' "$CONFIG_FILE")
STOPPED=$(awk -F'"' '/^STOPPED_CONTAINER=/ {print $2}' "$CONFIG_FILE")
+ INCLUDE_KERNEL=$(awk -F'"' '/^INCLUDE_KERNEL=/ {print $2}' "$CONFIG_FILE")
+ INCLUDE_PHASED_UPDATES=$(awk -F'"' '/^INCLUDE_PHASED_UPDATES=/ {print $2}' "$CONFIG_FILE")
+ BACKUP=$(awk -F'"' '/^BACKUP=/ {print $2}' "$CONFIG_FILE")
EXTRA_GLOBAL=$(awk -F'"' '/^EXTRA_GLOBAL=/ {print $2}' "$CONFIG_FILE")
EXTRA_IN_HEADLESS=$(awk -F'"' '/^IN_HEADLESS_MODE=/ {print $2}' "$CONFIG_FILE")
EXCLUDED=$(awk -F'"' '/^EXCLUDE=/ {print $2}' "$CONFIG_FILE")
ONLY=$(awk -F'"' '/^ONLY=/ {print $2}' "$CONFIG_FILE")
}
+# Backup
+CONTAINER_BACKUP () {
+ if [[ "$BACKUP" == true ]]; then
+ echo -e "${BL}[Info] Create backup for LXC $CONTAINER${CL}"
+ vzdump "$CONTAINER" --mode snapshot --storage "$(pvesm status -content backup | grep -m 1 -v ^Name | cut -d ' ' -f1)"
+ echo -e "${BL}[Info] Snapshot created${CL}\n"
+ else
+ echo -e "${OR}[Info] Backup Skipped by user for LXC $CONTAINER${CL}"
+ fi
+}
+VM_BACKUP () {
+ if [[ "$BACKUP" == true ]]; then
+ echo -e "${BL}[Info] Create backup for VM $VM${CL}"
+ vzdump "$VM" --mode snapshot --storage "$(pvesm status -content backup | grep -m 1 -v ^Name | cut -d ' ' -f1)"
+ echo -e "${BL}[Info] Snapshot created${CL}\n"
+ else
+ echo -e "${OR}[Info] Backup Skipped by user for LXC $CONTAINER${CL}"
+ fi
+}
+
# Extras
EXTRAS () {
if [[ "$EXTRA_GLOBAL" != true ]]; then
@@ -383,7 +407,7 @@ HOST_UPDATE_START () {
if [[ "$RICM" != true ]]; then true > /root/Proxmox-Updater/check-output; fi
for HOST in $HOSTS; do
# Check if Host/Node is available
- if ssh $HOST test >/dev/null 2>&1; [ $? -eq 255 ]; then
+ if ssh "$HOST" test >/dev/null 2>&1; [ $? -eq 255 ]; then
echo -e "${BL}[Info] ${OR}Skip Host${CL} : ${GN}$HOST${CL} ${OR}- can't connect${CL}\n"
else
UPDATE_HOST "$HOST"
@@ -422,13 +446,18 @@ UPDATE_HOST_ITSELF () {
echo -e "${OR}--- APT UPDATE ---${CL}" && apt-get update
if [[ "$HEADLESS" == true ]]; then
echo -e "\n${OR}--- APT UPGRADE HEADLESS ---${CL}" && \
- DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
+ DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
else
- echo -e "\n${OR}--- APT UPGRADE ---${CL}" && \
- apt-get dist-upgrade -y
+ if [[ "$INCLUDE_PHASED_UPDATES" != "true" ]]; then
+ echo -e "\n${OR}--- APT UPGRADE ---${CL}" && \
+ apt-get dist-upgrade -y
+ else
+ echo -e "\n${OR}--- APT UPGRADE ---${CL}" && \
+ apt-get -o APT::Get::Always-Include-Phased-Updates=true dist-upgrade -y
+ fi
fi
echo -e "\n${OR}--- APT CLEANING ---${CL}" && \
- apt-get --purge autoremove -y && echo
+ apt-get --purge autoremove -y && echo
CHOST="true"
UPDATE_CHECK
CHOST=""
@@ -450,18 +479,20 @@ CONTAINER_UPDATE_START () {
if [[ "$STATUS" == "status: stopped" && "$STOPPED" == true ]]; then
# Start the container
WILL_STOP="true"
- echo -e "${BL}[Info]${GN} Starting LXC${BL} $CONTAINER ${CL}"
+ CONTAINER_BACKUP
+ echo -e "${BL}[Info]${GN} Starting LXC ${BL}$CONTAINER ${CL}"
pct start "$CONTAINER"
- echo -e "${BL}[Info]${GN} Waiting for LXC${BL} $CONTAINER${CL}${GN} to start ${CL}"
+ echo -e "${BL}[Info]${GN} Waiting for LXC ${BL}$CONTAINER${CL}${GN} to start ${CL}"
sleep 5
UPDATE_CONTAINER "$CONTAINER"
# Stop the container
- echo -e "${BL}[Info]${GN} Shutting down LXC${BL} $CONTAINER ${CL}\n\n"
+ echo -e "${BL}[Info]${GN} Shutting down LXC ${BL}$CONTAINER ${CL}\n\n"
pct shutdown "$CONTAINER" &
WILL_STOP="false"
elif [[ "$STATUS" == "status: stopped" && "$STOPPED" != true ]]; then
echo -e "${BL}[Info] Skipped LXC $CONTAINER by user${CL}\n\n"
elif [[ "$STATUS" == "status: running" && "$RUNNING" == true ]]; then
+ CONTAINER_BACKUP
UPDATE_CONTAINER "$CONTAINER"
elif [[ "$STATUS" == "status: running" && "$RUNNING" != true ]]; then
echo -e "${BL}[Info] Skipped LXC $CONTAINER by user${CL}\n\n"
@@ -484,6 +515,11 @@ UPDATE_CONTAINER () {
NAME=$(pct exec "$CONTAINER" hostname)
fi
echo -e "${BL}[Info]${GN} Updating LXC ${BL}$CONTAINER${CL} : ${GN}$NAME${CL}\n"
+ # Check Internet connection
+ if ! pct exec "$CONTAINER" -- bash -c "ping -q -c1 $CHECK_URL &>/dev/null"; then
+ echo -e "${OR} Internet is not reachable - skip update${CL}\n"
+ return
+ fi
if [[ "$OS" =~ ubuntu ]] || [[ "$OS" =~ debian ]] || [[ "$OS" =~ devuan ]]; then
echo -e "${OR}--- APT UPDATE ---${CL}"
pct exec "$CONTAINER" -- bash -c "apt-get update"
@@ -492,7 +528,11 @@ UPDATE_CONTAINER () {
pct exec "$CONTAINER" -- bash -c "DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y"
else
echo -e "\n${OR}--- APT UPGRADE ---${CL}"
- pct exec "$CONTAINER" -- bash -c "apt-get dist-upgrade -y"
+ if [[ "$INCLUDE_PHASED_UPDATES" != "true" ]]; then
+ pct exec "$CONTAINER" -- bash -c "apt-get dist-upgrade -y"
+ else
+ pct exec "$CONTAINER" -- bash -c "apt-get -o APT::Get::Always-Include-Phased-Updates=true dist-upgrade -y"
+ fi
fi
echo -e "\n${OR}--- APT CLEANING ---${CL}"
pct exec "$CONTAINER" -- bash -c "apt-get --purge autoremove -y"
@@ -542,10 +582,11 @@ VM_UPDATE_START () {
else
STATUS=$(qm status "$VM")
if [[ "$STATUS" == "status: stopped" && "$STOPPED" == true ]]; then
- # Check if update is possiple
+ # Check if update is possible
if [[ $(qm config "$VM" | grep 'agent:' | sed 's/agent:\s*//') == 1 ]] || [[ -f /root/Proxmox-Updater/VMs/"$VM" ]]; then
# Start the VM
WILL_STOP="true"
+ VM_BACKUP
echo -e "${BL}[Info]${GN} Starting VM${BL} $VM ${CL}"
qm start "$VM" >/dev/null 2>&1
echo -e "${BL}[Info]${GN} Waiting for VM${BL} $VM${CL}${GN} to start${CL}"
@@ -563,6 +604,7 @@ VM_UPDATE_START () {
elif [[ "$STATUS" == "status: stopped" && "$STOPPED" != true ]]; then
echo -e "${BL}[Info] Skipped VM $VM by user${CL}\n\n"
elif [[ "$STATUS" == "status: running" && "$RUNNING" == true ]]; then
+ VM_BACKUP
UPDATE_VM "$VM"
elif [[ "$STATUS" == "status: running" && "$RUNNING" != true ]]; then
echo -e "${BL}[Info] Skipped VM $VM by user${CL}\n\n"
@@ -593,10 +635,19 @@ UPDATE_VM () {
if [[ "$OS_BASE" =~ l2 ]]; then
OS=$(ssh "$IP" hostnamectl | grep System)
if [[ "$OS" =~ Ubuntu ]] || [[ "$OS" =~ Debian ]] || [[ "$OS" =~ Devuan ]]; then
+ # Check Internet connection
+ if ! ssh "$IP" "ping -q -c1 $CHECK_URL &>/dev/null"; then
+ echo -e "${OR} Internet is not reachable - skip update${CL}\n"
+ return
+ fi
echo -e "${OR}--- APT UPDATE ---${CL}"
ssh "$IP" apt-get update
echo -e "\n${OR}--- APT UPGRADE ---${CL}"
- ssh "$IP" apt-get upgrade -y
+ if [[ "$INCLUDE_PHASED_UPDATES" != "true" ]]; then
+ ssh "$IP" apt-get upgrade -y
+ else
+ ssh "$IP" apt-get -o APT::Get::Always-Include-Phased-Updates=true upgrade -y
+ fi
echo -e "\n${OR}--- APT CLEANING ---${CL}"
ssh "$IP" apt-get --purge autoremove -y
EXTRAS
@@ -643,10 +694,19 @@ UPDATE_VM_QEMU () {
Please look here: \n"
OS=$(qm guest cmd "$VM" get-osinfo | grep name)
if [[ "$OS" =~ Ubuntu ]] || [[ "$OS" =~ Debian ]] || [[ "$OS" =~ Devuan ]]; then
+ # Check Internet connection
+ if ! qm guest exec "$VM" -- bash -c "ping -q -c1 $CHECK_URL &>/dev/null"; then
+ echo -e "${OR} Internet is not reachable - skip update${CL}\n"
+ return
+ fi
echo -e "${OR}--- APT UPDATE ---${CL}"
qm guest exec "$VM" -- bash -c "apt-get update" | tail -n +4 | head -n -1 | cut -c 17-
echo -e "\n${OR}--- APT UPGRADE ---${CL}"
- qm guest exec "$VM" --timeout 120 -- bash -c "apt-get upgrade -y" | tail -n +2 | head -n -1
+ if [[ "$INCLUDE_PHASED_UPDATES" != "true" ]]; then
+ qm guest exec "$VM" --timeout 120 -- bash -c "apt-get upgrade -y" | tail -n +2 | head -n -1
+ else
+ qm guest exec "$VM" --timeout 120 -- bash -c "apt-get -o APT::Get::Always-Include-Phased-Updates=true upgrade -y" | tail -n +2 | head -n -1
+ fi
echo -e "\n${OR}--- APT CLEANING ---${CL}"
qm guest exec "$VM" -- bash -c "apt-get --purge autoremove -y" | tail -n +4 | head -n -1 | cut -c 17-
echo
@@ -704,7 +764,7 @@ OUTPUT_TO_FILE () {
CLEAN_LOGFILE () {
if [[ "$RICM" != true ]]; then
tail -n +2 "$LOG_FILE" > tmp.log && mv tmp.log "$LOG_FILE"
- cat $LOG_FILE | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,3})*)?[mGK]//g" | tee "$LOG_FILE" >/dev/null 2>&1
+ cat "$LOG_FILE" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,3})*)?[mGK]//g" | tee "$LOG_FILE" >/dev/null 2>&1
chmod 640 "$LOG_FILE"
if [[ -f ./tmp.log ]]; then
rm -rf ./tmp.log
diff --git a/welcome-screen.sh b/welcome-screen.sh
index 103aaa9..72589a4 100644
--- a/welcome-screen.sh
+++ b/welcome-screen.sh
@@ -4,7 +4,7 @@
# Welcome-Screen #
##################
-VERSION="1.3.1"
+VERSION="1.3.3"
# Branch
BRANCH="master"
@@ -28,8 +28,8 @@ VERSION_CHECK () {
LOCAL_VERSION=$(awk -F'"' '/^VERSION=/ {print $2}' /usr/local/bin/update)
if [[ "$BRANCH" == beta ]]; then
echo -e "\n${OR} *** You are on beta branch ***${CL}"
- elif [[ "$BRANCH" == development ]]; then
- echo -e "\n${OR} *** You are on development branch ***${CL}"
+ elif [[ "$BRANCH" == develop ]]; then
+ echo -e "\n${OR} *** You are on develop branch ***${CL}"
fi
if [[ "$SERVER_VERSION" > "$LOCAL_VERSION" ]]; then
echo -e "\n${OR} *** A newer version is available ***${CL}\n\
@@ -51,8 +51,10 @@ READ_WRITE_CONFIG () {
WITH_VM=$(awk -F'"' '/^WITH_VM=/ {print $2}' $CONFIG_FILE)
RUNNING=$(awk -F'"' '/^RUNNING_CONTAINER=/ {print $2}' $CONFIG_FILE)
STOPPED=$(awk -F'"' '/^STOPPED_CONTAINER=/ {print $2}' $CONFIG_FILE)
- EXCLUDED=$(awk -F'"' '/^EXCLUDE=/ {print $2}' $CONFIG_FILE)
- ONLY=$(awk -F'"' '/^ONLY=/ {print $2}' $CONFIG_FILE)
+# EXCLUDED=$(awk -F'"' '/^EXCLUDE=/ {print $2}' $CONFIG_FILE)
+# ONLY=$(awk -F'"' '/^ONLY=/ {print $2}' $CONFIG_FILE)
+ EXCLUDED=$(awk -F'"' '/^EXCLUDE_UPDATE_CHECK=/ {print $2}' $CONFIG_FILE)
+ ONLY=$(awk -F'"' '/^ONLY_UPDATE_CHECK=/ {print $2}' $CONFIG_FILE)
if [[ $ONLY != "" ]]; then
echo -e "${OR}Only is set. Not all machines are checked.${CL}\n"
elif [[ $ONLY == "" && $EXCLUDED != "" ]]; then