|
170 | 170 |
|
171 | 171 |
|
172 | 172 |
|
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 | + |
203 | 199 |
|
204 | 200 |
|
205 | 201 | # Properly exit |
|
0 commit comments