File: cleanup.in

package info (click to toggle)
fwupdate 8-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 472 kB
  • ctags: 308
  • sloc: ansic: 3,114; makefile: 318; sh: 152
file content (29 lines) | stat: -rwxr-xr-x 675 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
set -e
if [ -e "@@DATADIR@@fwupdate/done" ]; then
	exit 0
fi

efibootmgr -q

BOOTNUM=$(efibootmgr | grep "Linux.Firmware.Updater" | sed "s/\ .*//; s/*//; s/Boot//")
if [ -n "$BOOTNUM" ]; then
	for num in $BOOTNUM; do
		efibootmgr -q -b "$num" -B
	done
fi


for x in /boot/efi/EFI/@@EFIDIR@@/fw/fwupdate-* ; do
	if [ "${x}" != "/boot/efi/EFI/@@EFIDIR@@/fw/fwupdate-*" ]; then
		rm -f "${x}"
	fi
done
for x in /sys/firmware/efi/efivars/fwupdate-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 ; do
	if [ "${x}" != "/sys/firmware/efi/efivars/fwupdate-*-0abba7dc-e516-4167-bbf5-4d9d1c739416" ]; then
		chattr -i "${x}"
		rm -f "${x}"
	fi
done

touch "@@DATADIR@@/fwupdate/done"