Skip to content

Commit

Permalink
feat: add warning when fsguard fails
Browse files Browse the repository at this point in the history
  • Loading branch information
axtloss authored and mirkobrombin committed Jan 12, 2024
1 parent f98bd7c commit 76d69d6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
12 changes: 0 additions & 12 deletions includes.container/fsguard_config.patch

This file was deleted.

32 changes: 32 additions & 0 deletions includes.container/usr/sbin/init
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
#!/bin/bash

function failed() {
#tput civis
squashfs="/.system/boot/fswarn.squash"
tmp="$(mktemp -d)"
chmod 0755 "$tmp"
mount -t squashfs -o loop $squashfs $tmp 2> /dev/null > /dev/null
mount --rbind /dev $tmp/dev 2> /dev/null > /dev/null

resolution=$(chroot "$tmp" /bin/bash -c '/usr/sbin/fbset | /bin/grep "mode " | /bin/sed "s/\"//g" | /bin/sed "s/-0//g" | /usr/bin/gawk '\''BEGIN{FS=" "}; {print $2}'\''')
chroot $tmp /bin/bash -c "convert -resize $resolution -background black -gravity center -extent $resolution /verification_failed.png bgra:/dev/fb0"
tput civis
read -sn1 input
if [[ "$input" == "c" ]]; then
tput cnorm
chroot $tmp /bin/bash -c "convert -resize $resolution -background black -gravity center -extent $resolution /continue_confirm.png bgra:/dev/fb0"
tput civis
read -sn1 input
if [[ "$input" == "y" ]]; then
return
else
poweroff -f
fi
else
poweroff -f
fi
tput cnorm
}

/usr/sbin/FsGuard verify /.system/FsGuard/filelist
if [[ $? -ne 0 ]]; then
failed
fi
exec /usr/lib/systemd/systemd "$@"
9 changes: 9 additions & 0 deletions modules/03-fswarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: fswarn
type: shell
commands:
- mkdir -p /boot/
- cp /sources/fswarn-x86_64.squash /boot/fswarn.squash
source:
type: tar
url: https://github.com/Vanilla-OS/fswarn/releases/download/v1.0-1/fswarn.tar.xz
checksum: 52f66710132138c21b81b56cb2d6edc7e59ad6eef4a4065b81af0f852d827dab
1 change: 1 addition & 0 deletions recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ modules:
- modules/00-vanilla-apx-gui
- modules/00-vanilla-sideload
- modules/02-waydroid-modules
- modules/03-fswarn
- modules/10-vanilla-abroot-rollback-notifier
- modules/20-gnome-core
- modules/30-gnome-essentials
Expand Down

0 comments on commit 76d69d6

Please sign in to comment.