From e15cc52003387b9ea4caceb5baafdb2615076d0a Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:02:00 +0200 Subject: [PATCH 1/7] 0.3.0: adding firmware upgrades for bare-metal systems --- bashpack.sh | 2 +- commands/update.sh | 56 +++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/bashpack.sh b/bashpack.sh index 8ef9ba7..9ab9340 100755 --- a/bashpack.sh +++ b/bashpack.sh @@ -26,7 +26,7 @@ URL="https://api.github.com/repos/bashpack-project/bashpack/tarball" # Github latest tarball -VERSION="0.2.24" +VERSION="0.3.0" NAME="Bashpack" NAME_LOWERCASE=$(echo "$NAME" | tr A-Z a-z) diff --git a/commands/update.sh b/commands/update.sh index 982a780..27117e8 100644 --- a/commands/update.sh +++ b/commands/update.sh @@ -170,36 +170,32 @@ fi -# # NEED TO RUN SOME TESTS BEFORE MAKE THIS PUBLIC -# # --- Update Firmwares (with fwupd) --- -# section_title=""$'\n'">>> fwupd" - -# # Usage : upgrade_with_fwupd <-y> -# upgrade_with_fwupd() { -# echo "Upgrading with fwupd... " - -# # Ask for confirmation or auto update if <-y>). -# if [[ ${1} != "-y" ]]; then -# read -p "$continue_question" install_confirmation_fwupd -# if [[ $install_confirmation_fwupd = $yes ]]; then -# loading "fwupdmgr upgrade" -# fi -# else -# loading "fwupdmgr upgrade" -# fi - -# echo "" -# echo "" -# } - -# if [[ $(exists_command "fwupdmgr") = "exists" ]]; then -# echo "$section_title" -# upgrade_with_fwupd $install_confirmation -# else -# echo "$section_title" -# install_package apt fwupd -# upgrade_with_fwupd $install_confirmation -# fi +# --- Update Firmwares (with fwupd) --- +section_title=""$'\n'">>> fwupd" + +# Checking if the system is bare-metal (and not virtualized) with the systemd-detect-virt command. +# If not bare-metal, firmwares will not be updated. +if [[ $(exists_command "systemd-detect-virt") = "exists" ]]; then + if [[ $(systemd-detect-virt) = "none" ]]; then + + # Process to firmware updates with fwupdmgr + if [[ $(exists_command "fwupdmgr") = "exists" ]]; then + echo "$section_title" + fwupdmgr upgrade $install_confirmation + else + echo "$section_title" + install_package apt fwupd + + if [[ $(exists_command "fwupdmgr") = "exists" ]]; then + fwupdmgr upgrade $install_confirmation + fi + fi + fi +else + echo "Error: can't detect if your system is bare-metal with the command 'systemd-detect-virt'. Will not upgrade firmwares." +fi + + # Properly exit From 13c671609c8aa6d1a2c2009dfe085a085564e6a2 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:10:51 +0200 Subject: [PATCH 2/7] Update README --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7b03ca0..71b0c69 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,13 @@ You can easily setup **automations** with the differents **options**.
## Features -* (available) Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool) and [Snapcraft](https://snapcraft.io/) packages (Snapcraft is not installed with this script, it just handled if already used)). -* (incoming) Unified Linux updates (firmwares with [fwupd](https://github.com/fwupd/fwupd)). +* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* packages & firmwares with [fwupd](https://github.com/fwupd/fwupd))*. * (incoming) Secure Linux firewall (close ports with [nftables](https://wiki.nftables.org/wiki-nftables/index.php/Main_Page) ([Docker](https://www.docker.com/) compatible)). * (incoming) Routes over VPN to one or many points ([OpenVPN](https://openvpn.net/) compatible). +
+* _Snapcraft is not installed with this script, it's just handled if already used._ +* _fwupd is installed only if your system is bare-metal._
## Quick start @@ -78,4 +80,4 @@ Incoming ### Routes over VPN Incoming -
\ No newline at end of file +
From 486bc527d7a0c676756475b8afee8c1662a44742 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:12:00 +0200 Subject: [PATCH 3/7] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 71b0c69..eb6954a 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,10 @@ You can easily setup **automations** with the differents **options**. * (incoming) Routes over VPN to one or many points ([OpenVPN](https://openvpn.net/) compatible).
+ * _Snapcraft is not installed with this script, it's just handled if already used._ * _fwupd is installed only if your system is bare-metal._ +
## Quick start From 59c7b7a3e2d86096c40c36e3e1a7cfa3bc038333 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:14:40 +0200 Subject: [PATCH 4/7] Update README --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eb6954a..37fce91 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,15 @@ You can easily setup **automations** with the differents **options**.
## Features -* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* packages & firmwares with [fwupd](https://github.com/fwupd/fwupd))*. +* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* packages & firmwares with [fwupd](https://github.com/fwupd/fwupd)*). * (incoming) Secure Linux firewall (close ports with [nftables](https://wiki.nftables.org/wiki-nftables/index.php/Main_Page) ([Docker](https://www.docker.com/) compatible)). * (incoming) Routes over VPN to one or many points ([OpenVPN](https://openvpn.net/) compatible).
-* _Snapcraft is not installed with this script, it's just handled if already used._ -* _fwupd is installed only if your system is bare-metal._ +\* _Snapcraft is not installed with this script, it's just handled if already used._ + +\* _fwupd is installed only if your system is bare-metal._
From 144d942c82b2da79dae63c4be265e42990831a24 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:15:18 +0200 Subject: [PATCH 5/7] Update README --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 37fce91..097a09c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ You can easily setup **automations** with the differents **options**.
\* _Snapcraft is not installed with this script, it's just handled if already used._ - \* _fwupd is installed only if your system is bare-metal._
From 6cf41b8c150dce8e5978d456188a2c6019e86d71 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:16:55 +0200 Subject: [PATCH 6/7] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 097a09c..37fce91 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ You can easily setup **automations** with the differents **options**.
\* _Snapcraft is not installed with this script, it's just handled if already used._ + \* _fwupd is installed only if your system is bare-metal._
From d8185a38835082eb57ac275846e11689738dca62 Mon Sep 17 00:00:00 2001 From: ggtrd Date: Thu, 4 Jul 2024 18:18:39 +0200 Subject: [PATCH 7/7] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 37fce91..902c15e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can easily setup **automations** with the differents **options**.
## Features -* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* packages & firmwares with [fwupd](https://github.com/fwupd/fwupd)*). +* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* & firmwares with [fwupd](https://github.com/fwupd/fwupd)*). * (incoming) Secure Linux firewall (close ports with [nftables](https://wiki.nftables.org/wiki-nftables/index.php/Main_Page) ([Docker](https://www.docker.com/) compatible)). * (incoming) Routes over VPN to one or many points ([OpenVPN](https://openvpn.net/) compatible).