Skip to content

Commit

Permalink
shellcheck change, $ is unnecessary on arithmetic variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrfai committed May 19, 2020
1 parent 87501da commit 143b9ed
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bin/fai-cd
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ calculate_required_size() {

# not dividing by 1024 to get the exact, this allows us to get some additional space
# add some addition space
count=$(($size/850 + $space))
count=$((size/850 + space))
}

provide_memtest_boot_option() {
Expand Down Expand Up @@ -407,7 +407,7 @@ while getopts "AekfhHg:Jbs:SBMn:m:V:c:C:d:" opt ; do
?) usage ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))
isoname=$1


Expand Down
2 changes: 1 addition & 1 deletion bin/fai-class
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ setup() {
*) usage 1 ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))
[ -z "$2" ] || [ -n "$3" ] && usage 1

classdir=$1
Expand Down
2 changes: 1 addition & 1 deletion bin/fai-debconf
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ while getopts "hvsfd" opt ; do
v) verbose=1; v=-v ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))
[ -z "$1" ] || [ -n "$2" ] && usage 1
debconfdir=$1 # will be $FAI/debconf

Expand Down
2 changes: 1 addition & 1 deletion bin/fai-diskimage
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cleanup() {
for i in {1..8}; do
umount $dir >&/dev/null
[ $? -eq 0 ] && break
[ $(($i % 3)) -eq 0 ] && echo "Waiting for background jobs to finish."
[ $((i % 3)) -eq 0 ] && echo "Waiting for background jobs to finish."
sleep $i
done
done
Expand Down
4 changes: 2 additions & 2 deletions bin/fai-do-scripts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ while getopts "nhL:" opt ; do
n) fake=1 ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))
[ -z "$1" ] || [ -n "$2" ] && usage 1

if [ "x$classes" = "x" ]; then
Expand All @@ -227,5 +227,5 @@ fi

call_conf $1
# move error number from child scripts to 100+x if any error happened
[ $maxstatus -gt 0 ] && maxstatus=$((100+$maxstatus))
[ $maxstatus -gt 0 ] && maxstatus=$((100+maxstatus))
exit $maxstatus
2 changes: 1 addition & 1 deletion bin/fai-mirror
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ while getopts "a:bBvhx:pc:C:m:s:P:V" opt ; do
?) die 1 "Unknown option";;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

# use FAI_ETC_DIR from environment variable
[ -n "$FAI_ETC_DIR" -a -z "$cfdir" ] && echo "Using environment variable \$FAI_ETC_DIR."
Expand Down
2 changes: 1 addition & 1 deletion bin/ftar
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ while getopts 1hDdrvs:t:c:i opt ; do
h) usage ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

[ "$1" ] || usage

Expand Down
2 changes: 1 addition & 1 deletion dev-utils/fai-kvm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ while getopts "EbUhnNu:s:m:d:VD:t:" opt ; do
?) die 1 "Unknown option";;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

if [ -z "$1" ]; then
echo Missing argument. pxe, cd or disk
Expand Down
2 changes: 1 addition & 1 deletion dev-utils/fai-mk-network
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ while getopts Phri: opt ; do
i) netdev=$OPTARG ;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

if [ $(id -u) != "0" ]; then
echo "You must run this program as root."
Expand Down
2 changes: 1 addition & 1 deletion lib/fetch-basefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ while getopts m opt ; do
m) mount=1 ;;
esac
done
#shift $(($OPTIND - 1))
#shift $((OPTIND - 1))

# get list of all files at URL
flist=$(lftp -e 'cls;exit' $url 2>/dev/null)
Expand Down
2 changes: 1 addition & 1 deletion lib/mkramdisk
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ while getopts ans:u opt ; do
n) mtab="-n" ;; # do not wirte to /etc/mtab
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))

if [ -n "$FAI_NORAMDISK" ]; then
echo "The use of \$FAI_NORAMDISK is now deprecated. Please use \$FAI_RAMDISKS instead." >&2
Expand Down
4 changes: 2 additions & 2 deletions lib/subroutines
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ task() {
task_error_func=''
taskduration[$taskname]=$SECONDS
task_$taskname "$@"
[ $duration -eq 1 ] && echo "Duration of task $taskname: " $(($SECONDS-${taskduration[$taskname]}))"s"
[ $duration -eq 1 ] && echo "Duration of task $taskname: " $((SECONDS-${taskduration[$taskname]}))"s"
sendmon "TASKEND $taskname $task_local_error"
if [ "$task_local_error" -ne 0 ] ; then
echo "Exit code task_$taskname: $task_local_error" >&2
Expand Down Expand Up @@ -1165,7 +1165,7 @@ task_finish() {
fai-divert -R
rm -f $FAI_ROOT/etc/apt/apt.conf.d/{10,90}fai
echo -n "FAI finished at: ";date
echo "The $FAI_ACTION took $(($(cut -d . -f 1 /proc/uptime)-$start_seconds)) seconds."
echo "The $FAI_ACTION took $(($(cut -d . -f 1 /proc/uptime) - start_seconds)) seconds."
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
task_chboot() {
Expand Down

0 comments on commit 143b9ed

Please sign in to comment.