Add shellcheck fixes and enhancements
This commit is contained in:
parent
9336aabaf2
commit
401da9582d
2 changed files with 7 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
|||
shellcheck:
|
||||
stage: build
|
||||
script:
|
||||
- /usr/bin/shellcheck share_lun_ui_fix.sh
|
||||
- /usr/bin/shellcheck -e SC2164,SC2086 share_lun_ui_fix.sh
|
|
@ -133,8 +133,8 @@ EOF
|
|||
}
|
||||
|
||||
backup_configs() {
|
||||
cd "/$volume/._share/"
|
||||
tar -cf "/var/backups/$volume_sharelunconfig.$(date +%s).tar" ./* 2>/dev/null
|
||||
cd "/$volume/._share/"
|
||||
tar -cf "/var/backups/$volume.sharelunconfig.$(date +%s).tar" ./* 2>/dev/null
|
||||
}
|
||||
|
||||
echo "==============================="
|
||||
|
@ -168,12 +168,13 @@ else
|
|||
echo "==============================="
|
||||
for volume in $x; do
|
||||
echo "= Investigating volume /$volume..."
|
||||
objects=$(cd /"$volume"; ls -dA */ 2>/dev/null)
|
||||
objects=$(cd /"$volume"; ls -dA ./*/ 2>/dev/null)
|
||||
if [[ $? == 2 ]]; then
|
||||
echo "No shares or LUNs found."
|
||||
else
|
||||
objects=$(echo "$objects" |egrep -v "^.apps\/$|^home\/$|^.purge\/$|^._share\/$|^.timemachine\/$|^.vault\/$|^.TemporaryItems\/$" | sed 's/\/$//')
|
||||
echo "= Objects found:" $objects
|
||||
objects=$(echo "$objects" |egrep -v "^.apps\/$|^home\/$|^.purge\/$|^._share\/$|^.timemachine\/$|^.vault\/$|^.TemporaryItems\/$" | sed 's/\/$//;s/\.\///')
|
||||
echo "= Objects found: $(echo $objects | wc -w)"
|
||||
echo $objects
|
||||
backup_configs
|
||||
for item in $objects; do
|
||||
echo "== Reviewing $item"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue