diff options
author | 2016-05-26 14:59:48 +0000 | |
---|---|---|
committer | 2016-05-26 14:59:48 +0000 | |
commit | 90411c6c71e41b5fb8c25e74520082086bed97f0 (patch) | |
tree | 64252cfd7bfccaf271c54e0c1901d77638ca6f10 | |
parent | Extend 0x1234 keys form to more bits so that Unicode keys work. (diff) | |
download | wireguard-openbsd-90411c6c71e41b5fb8c25e74520082086bed97f0.tar.xz wireguard-openbsd-90411c6c71e41b5fb8c25e74520082086bed97f0.zip |
- rename rebuildlibs() to reorder_libs()
- move the info message inside the function
- skip reordering if /usr/lib is on a nfs mounted filesystem
- temporarily remount rw if /usr/lib is on a ro ffs file-system
OK deraadt
-rw-r--r-- | etc/rc | 39 |
1 files changed, 32 insertions, 7 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.480 2016/05/22 15:16:47 rpe Exp $ +# $OpenBSD: rc,v 1.481 2016/05/26 14:59:48 rpe Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the @@ -158,10 +158,20 @@ make_keys() { ssh-keygen -A } -rebuildlibs() { - local _l _liba _libas _tmpdir +reorder_libs() { + local _l _liba _libas _tmpdir _remount=false + local _dkdev=/dev/$(stat -L -f '%Sd' /usr/lib) + local _mp=$(mount | grep "^$_dkdev") - # Only choose newest + echo -n 'reordering libraries:' + + # Skip if /usr/lib is on a nfs mounted filesystem. + if [[ $_mp == *' type nfs '* ]]; then + echo ' skipped.' + return + fi + + # Only choose the latest version of the libraries. for _liba in /usr/lib/libc.so.*.a; do _liba=$(ls ${_liba%%.[0-9]*}*.a | sort -V | tail -1) for _l in $_libas; do @@ -170,6 +180,16 @@ rebuildlibs() { _libas="$_libas $_liba" done + # Remount read-write, if /usr/lib is on a read-only ffs filesystem. + if [[ $_mp == *' type ffs '*'read-only'* ]]; then + if mount -u -w $_dkdev; then + _remount=true + else + echo ' failed.' + return + fi + fi + for _liba in $_libas; do _tmpdir=$(mktemp -dq /tmp/_librebuild.XXXXXXXXXXXX) || return ( @@ -185,6 +205,13 @@ rebuildlibs() { ) rm -rf /tmp/_librebuild.${_tmpdir#*.} done + + # Restore previous mount state if it was changed. + if $_remount; then + mount -u -r $_dkdev + fi + + echo ' done.' } run_upgrade_script() { @@ -378,9 +405,7 @@ mount -s /var >/dev/null 2>&1 random_seed -echo -n 'reordering libraries:' -rebuildlibs -echo ' done.' +reorder_libs # Clean up left-over files. rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/* |