Skip to content

Commit

Permalink
prepate more features
Browse files Browse the repository at this point in the history
  • Loading branch information
BassT23 committed Dec 14, 2024
1 parent a9102ec commit d6217cf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
3 changes: 2 additions & 1 deletion VMs/example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
IP="111.111.111.111"
USER="used_ssh_user"
USER="used_ssh_user"
SSH_VM_PORT="22
34 changes: 18 additions & 16 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
###########

# shellcheck disable=SC2034
VERSION="1.8"
VERSION="1.8.1"

# Branch
BRANCH="develop"
Expand Down Expand Up @@ -290,27 +290,29 @@ UPDATE () {
}

CHECK_DIFF () {
if ! cmp -s "$TEMP_FILES"/"$f" "$LOCAL_FILES"/"$f"; then
echo -e "The file ${OR}$f${CL}\n \
if [ -f "$LOCAL_FILES"/"$f" ]; then
if ! cmp -s "$TEMP_FILES"/"$f" "$LOCAL_FILES"/"$f"; then
echo -e "The file ${OR}$f${CL}\n \
==> Modified (by you or by a script) since installation.\n \
What would you like to do about it ? Your options are:\n \
Y or y : install the package maintainer's version (old file will be saved 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 install new version and backup current file."
read -p "*** $f (Y/y/N/n/S/s) [default=Y] ?" -r
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
echo -e "\n${BL}[Info]${GN} Installed server version and backed up old file${CL}\n"
cp -f "$LOCAL_FILES"/"$f" "$LOCAL_FILES"/"$f".bak
mv "$TEMP_FILES"/"$f" "$LOCAL_FILES"/"$f"
elif [[ $REPLY =~ ^[Nn]$ ]]; then
echo -e "\n${BL}[Info]${GN} Kept old file${CL}\n"
elif [[ $REPLY =~ ^[Ss]$ ]]; then
echo
diff "$TEMP_FILES"/"$f" "$LOCAL_FILES/$f"
else
echo -e "\n${BL}[Info]${OR} Skip this file${CL}\n"
fi
read -p "*** $f (Y/y/N/n/S/s) [default=Y] ?" -r
if [[ $REPLY =~ ^[Yy]$ || $REPLY = "" ]]; then
echo -e "\n${BL}[Info]${GN} Installed server version and backed up old file${CL}\n"
cp -f "$LOCAL_FILES"/"$f" "$LOCAL_FILES"/"$f".bak
mv "$TEMP_FILES"/"$f" "$LOCAL_FILES"/"$f"
elif [[ $REPLY =~ ^[Nn]$ ]]; then
echo -e "\n${BL}[Info]${GN} Kept old file${CL}\n"
elif [[ $REPLY =~ ^[Ss]$ ]]; then
echo
diff "$TEMP_FILES"/"$f" "$LOCAL_FILES/$f"
else
echo -e "\n${BL}[Info]${OR} Skip this file${CL}\n"
fi
fi
fi
}

Expand Down
2 changes: 1 addition & 1 deletion update.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RUNNING_CONTAINER="true"
STOPPED_VM="true"
RUNNING_VM="true"

INCLUDE_KERNEL="true"
INCLUDE_KERNEL="true" # not included for now
INCLUDE_PHASED_UPDATES="false"
INCLUDE_LXC_CLEAN="true" # true only in develop
INCLUDE_FSTRIM="true" # true only in develop
Expand Down
7 changes: 5 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,6 @@ READ_CONFIG () {
STOPPED_CONTAINER=$(awk -F'"' '/^STOPPED_CONTAINER=/ {print $2}' "$CONFIG_FILE")
RUNNING_VM=$(awk -F'"' '/^RUNNING_VM=/ {print $2}' "$CONFIG_FILE")
STOPPED_VM=$(awk -F'"' '/^STOPPED_VM=/ {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")
SNAPSHOT=$(awk -F'"' '/^SNAPSHOT/ {print $2}' "$CONFIG_FILE")
KEEP_SNAPSHOT=$(awk -F'"' '/^KEEP_SNAPSHOT/ {print $2}' "$CONFIG_FILE")
BACKUP=$(awk -F'"' '/^BACKUP=/ {print $2}' "$CONFIG_FILE")
Expand All @@ -349,6 +347,11 @@ READ_CONFIG () {
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")
INCLUDE_PHASED_UPDATES=$(awk -F'"' '/^INCLUDE_PHASED_UPDATES=/ {print $2}' "$CONFIG_FILE")
# INCLUDE_LXC_CLEAN=$(awk -F'"' '/^INCLUDE_LXC_CLEAN=/ {print $2}' "$CONFIG_FILE")
# INCLUDE_FSTRIM=$(awk -F'"' '/^INCLUDE_FSTRIM=/ {print $2}' "$CONFIG_FILE")
# INCLUDE_KERNEL=$(awk -F'"' '/^INCLUDE_KERNEL=/ {print $2}' "$CONFIG_FILE")
# INCLUDE_KERNEL_CLEAN=$(awk -F'"' '/^INCLUDE_KERNEL_CLEAN=/ {print $2}' "$CONFIG_FILE")
}

# Snapshot/Backup
Expand Down

0 comments on commit d6217cf

Please sign in to comment.