Skip to content

Commit d734770

Browse files
authored
Merge pull request #13 from bashpack-project/working
0.3.0: adding firmware upgrades for bare-metal systems
2 parents 268e9a3 + d8185a3 commit d734770

File tree

3 files changed

+35
-34
lines changed

3 files changed

+35
-34
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ You can easily setup **automations** with the differents **options**.
1010
<br>
1111

1212
## Features
13-
* (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)).
14-
* (incoming) Unified Linux updates (firmwares with [fwupd](https://github.com/fwupd/fwupd)).
13+
* Unified Linux updates ([APT](https://fr.wikipedia.org/wiki/Advanced_Packaging_Tool), [Snapcraft](https://snapcraft.io/)* & firmwares with [fwupd](https://github.com/fwupd/fwupd)*).
1514
* (incoming) Secure Linux firewall (close ports with [nftables](https://wiki.nftables.org/wiki-nftables/index.php/Main_Page) ([Docker](https://www.docker.com/) compatible)).
1615
* (incoming) Routes over VPN to one or many points ([OpenVPN](https://openvpn.net/) compatible).
1716

1817
<br>
1918

19+
\* _Snapcraft is not installed with this script, it's just handled if already used._
20+
21+
\* _fwupd is installed only if your system is bare-metal._
22+
23+
<br>
24+
2025
## Quick start
2126
Copy/paste the following command blocks on your Linux terminal to manage your Bashpack installation.
2227
* _You must be sudo._
@@ -78,4 +83,4 @@ Incoming
7883
### Routes over VPN
7984
Incoming
8085

81-
<br>
86+
<br>

bashpack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
URL="https://api.github.com/repos/bashpack-project/bashpack/tarball" # Github latest tarball
2828

29-
VERSION="0.2.24"
29+
VERSION="0.3.0"
3030

3131
NAME="Bashpack"
3232
NAME_LOWERCASE=$(echo "$NAME" | tr A-Z a-z)

commands/update.sh

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,36 +170,32 @@ fi
170170

171171

172172

173-
# # NEED TO RUN SOME TESTS BEFORE MAKE THIS PUBLIC
174-
# # --- Update Firmwares (with fwupd) ---
175-
# section_title=""$'\n'">>> fwupd"
176-
177-
# # Usage : upgrade_with_fwupd <-y>
178-
# upgrade_with_fwupd() {
179-
# echo "Upgrading with fwupd... "
180-
181-
# # Ask for confirmation or auto update if <-y>).
182-
# if [[ ${1} != "-y" ]]; then
183-
# read -p "$continue_question" install_confirmation_fwupd
184-
# if [[ $install_confirmation_fwupd = $yes ]]; then
185-
# loading "fwupdmgr upgrade"
186-
# fi
187-
# else
188-
# loading "fwupdmgr upgrade"
189-
# fi
190-
191-
# echo ""
192-
# echo ""
193-
# }
194-
195-
# if [[ $(exists_command "fwupdmgr") = "exists" ]]; then
196-
# echo "$section_title"
197-
# upgrade_with_fwupd $install_confirmation
198-
# else
199-
# echo "$section_title"
200-
# install_package apt fwupd
201-
# upgrade_with_fwupd $install_confirmation
202-
# fi
173+
# --- Update Firmwares (with fwupd) ---
174+
section_title=""$'\n'">>> fwupd"
175+
176+
# Checking if the system is bare-metal (and not virtualized) with the systemd-detect-virt command.
177+
# If not bare-metal, firmwares will not be updated.
178+
if [[ $(exists_command "systemd-detect-virt") = "exists" ]]; then
179+
if [[ $(systemd-detect-virt) = "none" ]]; then
180+
181+
# Process to firmware updates with fwupdmgr
182+
if [[ $(exists_command "fwupdmgr") = "exists" ]]; then
183+
echo "$section_title"
184+
fwupdmgr upgrade $install_confirmation
185+
else
186+
echo "$section_title"
187+
install_package apt fwupd
188+
189+
if [[ $(exists_command "fwupdmgr") = "exists" ]]; then
190+
fwupdmgr upgrade $install_confirmation
191+
fi
192+
fi
193+
fi
194+
else
195+
echo "Error: can't detect if your system is bare-metal with the command 'systemd-detect-virt'. Will not upgrade firmwares."
196+
fi
197+
198+
203199

204200

205201
# Properly exit

0 commit comments

Comments
 (0)