| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | export PATH=/bin:/usr/bin:/sbin:/usr/sbin LC_ALL=C |
| 4 | trap '/sbin/poweroff -f' EXIT |
| 5 | |
| 6 | test "$(uname -o)" = Vinix |
| 7 | test "$(id -u)" = 0 |
| 8 | test "$(vpac o --quiet /usr/bin/pkg)" = vinix-pkg |
| 9 | test "$(stat -c '%a' /usr/include/libiberty)" = 700 |
| 10 | |
| 11 | pkg upgrade >/tmp/public-mode-upgrade.log 2>&1 || { |
| 12 | cat /tmp/public-mode-upgrade.log |
| 13 | exit 1 |
| 14 | } |
| 15 | cat /tmp/public-mode-upgrade.log |
| 16 | if grep -E '^error:|failed to run .*hook|scriptlet failed' /tmp/public-mode-upgrade.log; then |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | while IFS=' ' read -r name version; do |
| 21 | test -s "/var/lib/vpac/local/$name-$version/desc" |
| 22 | vpac q -F validation "local/$name" | |
| 23 | grep -Eq '^validation[[:space:]]+signature$' |
| 24 | done </usr/share/vinix-mode-upgrade/versions |
| 25 | |
| 26 | while IFS= read -r path; do |
| 27 | test -d "$path" |
| 28 | test "$(stat -c '%a' "$path")" = 755 |
| 29 | done </usr/share/vinix-mode-upgrade/paths |
| 30 | |
| 31 | /bin/su -s /bin/sh -c 'test -r /usr/lib/bfd-plugins/liblto_plugin.so && |
| 32 | test -r /usr/include/libiberty/libiberty.h && |
| 33 | test -r /usr/lib/cmake/FreeGLUT/FreeGLUTConfig.cmake && |
| 34 | test -r /usr/lib/xorg/modules/input/inputtest_drv.so && |
| 35 | test -r /usr/lib/xorg/modules/extensions/libglx.so && |
| 36 | test -r /usr/lib/xorg/modules/drivers/fbdev_drv.so && |
| 37 | test -r /etc/X11/xinit/xinitrc' nobody |
| 38 | |
| 39 | echo 'Vinix upgraded the signed compiler and X11 packages and restored public access' |
| 40 | echo 'VPAC FIXTURE GUEST PASS' |
| 41 | |