Skip to content

Commit

Permalink
fix(usrmount): shellcheck for modules.d/98usrmount
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldh committed Mar 30, 2021
1 parent f7844c2 commit 957ab75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Empty file added modules.d/98usrmount/.shchkdir
Empty file.
14 changes: 8 additions & 6 deletions modules.d/98usrmount/mount-usr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ type fsck_single > /dev/null 2>&1 || . /lib/fs-lib.sh
filtersubvol() {
local _oldifs
_oldifs="$IFS"
IFS=","
set $*
local IFS=","
# shellcheck disable=SC2086
set -- $1
IFS="$_oldifs"
while [ $# -gt 0 ]; do
case $1 in
subvol\=*) : ;;
'subvol='*) : ;;
*) printf '%s' "${1}," ;;
esac
shift
Expand All @@ -31,6 +32,7 @@ fsck_usr() {
if [ -f "$NEWROOT"/forcefsck ] || getargbool 0 forcefsck; then
_fsckoptions="-f $_fsckoptions"
elif [ -f "$NEWROOT"/.autofsck ]; then
# shellcheck disable=SC1090
[ -f "$NEWROOT"/etc/sysconfig/autofsck ] && . "$NEWROOT"/etc/sysconfig/autofsck
if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
Expand All @@ -48,15 +50,15 @@ fsck_usr() {
}

mount_usr() {
local _dev _mp _fs _opts _rest _usr_found _ret _freq _passno
local _dev _mp _fs _opts _ _usr_found _ _freq _passno
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
while read -r _dev _mp _fs _opts _freq _passno || [ -n "$_dev" ]; do
[ "${_dev%%#*}" != "$_dev" ] && continue
if [ "$_mp" = "/usr" ]; then
_dev="$(label_uuid_to_dev "$_dev")"

if strstr "$_opts" "subvol=" \
&& [ "${root#block:}" -ef $_dev ] \
&& [ "${root#block:}" -ef "$_dev" ] \
&& [ -n "$rflags" ]; then
# for btrfs subvolumes we have to mount /usr with the same rflags
rflags=$(filtersubvol "$rflags")
Expand Down

0 comments on commit 957ab75

Please sign in to comment.