Skip to content

Commit

Permalink
Don't use absolute path for commands in load/unload scripts
Browse files Browse the repository at this point in the history
Just let the shell lookup from the user's $PATH since some tools may not
be installed in the absolute path used in the scripts.

Signed-off-by: Javier Martinez Canillas <[email protected]>
  • Loading branch information
martinezjavier committed Feb 25, 2018
1 parent c400d26 commit e3c38f8
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion sbull/sbull_load
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion sbull/sbull_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="sbull"
device="sbull"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# Remove stale nodes
rm -f /dev/${device}[a-d]* /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion scull/scull_load
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# invoke insmod with all arguments we got
# and use a pathname, as insmod doesn't look in . by default
/sbin/insmod ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

# retrieve major number
major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices)
Expand Down
2 changes: 1 addition & 1 deletion scull/scull_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="scull"
device="scull"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# Remove stale nodes

Expand Down
2 changes: 1 addition & 1 deletion scullc/scullc_load
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -f /dev/${device}?

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion scullc/scullc_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="scullc"
device="scullc"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# remove nodes
rm -f /dev/${device}[0-3] /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion sculld/sculld_load
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -f /dev/${device}?

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
/insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion sculld/sculld_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="sculld"
device="sculld"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# remove nodes
rm -f /dev/${device}[0-3] /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion scullp/scullp_load
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -f /dev/${device}?

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion scullp/scullp_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="scullp"
device="scullp"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# remove nodes
rm -f /dev/${device}[0-3] /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion scullv/scullv_load
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -f /dev/${device}?

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion scullv/scullv_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="scullv"
device="scullv"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# remove nodes
rm -f /dev/${device}[0-3] /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion short/short_load
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion short/short_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="short"
device="short"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# Remove stale nodes

Expand Down
2 changes: 1 addition & 1 deletion shortprint/shortprint_load
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion shortprint/shortprint_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="shortprint"
device="shortprint"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# Remove stale nodes
rm -f /dev/${device}
Expand Down
2 changes: 1 addition & 1 deletion simple/simple_load
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

# invoke insmod with all arguments we got
# and use a pathname, as newer modutils don't look in . by default
/sbin/insmod -f ./$module.ko $* || exit 1
insmod ./$module.ko $* || exit 1

major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

Expand Down
2 changes: 1 addition & 1 deletion simple/simple_unload
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module="simple"
device="simple"

# invoke rmmod with all arguments we got
/sbin/rmmod $module $* || exit 1
rmmod $module $* || exit 1

# Remove stale nodes
rm -f /dev/${device}[rn]
Expand Down
2 changes: 0 additions & 2 deletions snull/snull_load
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

export PATH=/sbin:/bin

# Use a pathname, as new modutils don't look in the current dir by default
insmod ./snull.ko $*
ifconfig sn0 local0
Expand Down
6 changes: 3 additions & 3 deletions snull/snull_unload
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

/sbin/ifconfig sn0 down
/sbin/ifconfig sn1 down
/sbin/rmmod snull
ifconfig sn0 down
ifconfig sn1 down
rmmod snull

0 comments on commit e3c38f8

Please sign in to comment.