From f49f151668f1d6b259fb13cfefc1bb4086c5e7f3 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 29 Jul 2017 20:27:19 +0200 Subject: [PATCH] add linting --- .gitlab-ci.yml | 9 +++++++++ bin/gitlab-backup.sh | 2 +- bin/install-dotfiles.sh | 8 ++++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8d80893 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,9 @@ +image: bash + +stages: + - lint + - test + +lint: + stage: install + script: 'apk add shellcheck && shellcheck .bash* bin/*' \ No newline at end of file diff --git a/bin/gitlab-backup.sh b/bin/gitlab-backup.sh index 97854f6..90edbcf 100755 --- a/bin/gitlab-backup.sh +++ b/bin/gitlab-backup.sh @@ -10,7 +10,7 @@ # Create a time-stamped .tar file in the current directory. # The .tar file will be readable only to root. -cd /var/opt/gitlab/backups/ +cd /var/opt/gitlab/backups/ || exit sh -c 'umask 0077; tar -cf $(date "+%s-%F-etc-gitlab.tar") -C / etc/gitlab' # run GitLab system backup diff --git a/bin/install-dotfiles.sh b/bin/install-dotfiles.sh index 5f16f4c..583edce 100755 --- a/bin/install-dotfiles.sh +++ b/bin/install-dotfiles.sh @@ -7,16 +7,16 @@ for FILE in $FILES; do # remove old versions if [ -f "$HOME/$FILE" ]; then - rm $HOME/$FILE + rm "$HOME"/"$FILE" elif [ -d "$HOME/$FILE" ]; then - rm -r $HOME/$FILE + rm -r "${HOME:?}"/"$FILE" fi # symlink files - ln -s $PWD/$FILE $HOME/$FILE + ln -s "$PWD"/"$FILE" "$HOME"/"$FILE" echo "$(tput setaf 64)✓$(tput sgr0) Symlink created to $(tput setaf 37)$FILE$(tput sgr0)" done # source what we just created -source $HOME/.profile +source "$HOME"/.profile