aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-01-01 17:37:27 -0200
committerEuAndreh <eu@euandre.org>2019-01-01 17:37:27 -0200
commit4e8c39da58d078167a0a1bc88c4f9248b76e8fed (patch)
tree21e6b4f75326bb10b57c1b063b65707ffddfaaaa
parentmrconfig.ini. (diff)
downloaddotfiles-4e8c39da58d078167a0a1bc88c4f9248b76e8fed.tar.gz
dotfiles-4e8c39da58d078167a0a1bc88c4f9248b76e8fed.tar.xz
Lint some bash files with shellcheck.
-rw-r--r--bash/agents.sh7
-rw-r--r--bash/aliases.sh12
-rw-r--r--bash/fake-symlinks.sh15
-rw-r--r--bash/youtube.sh14
-rw-r--r--templates/env.sh6
5 files changed, 31 insertions, 23 deletions
diff --git a/bash/agents.sh b/bash/agents.sh
index 7ce1fef..5dec196 100644
--- a/bash/agents.sh
+++ b/bash/agents.sh
@@ -2,7 +2,8 @@
eval "$(thefuck --alias f)"
-export GPG_TTY=$(tty)
+GPG_TTY=$(tty)
+export GPG_TTY
export SSH_ENV="$HOME/.ssh/environment"
start_agent() {
@@ -10,13 +11,15 @@ start_agent() {
ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
+ # shellcheck source=/dev/null
. "${SSH_ENV}" > /dev/null
ssh-add
}
[ -f "${SSH_ENV}" ] && {
+ # shellcheck source=/dev/null
. "${SSH_ENV}" > /dev/null
- ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
+ pgrep ^ssh-agent$ > /dev/null || {
start_agent
}
} || start_agent
diff --git a/bash/aliases.sh b/bash/aliases.sh
index 4f97cfa..403709c 100644
--- a/bash/aliases.sh
+++ b/bash/aliases.sh
@@ -30,14 +30,12 @@ alias fim="play $DOTFILES/bash/Positive.ogg &> /dev/null"
alias mux="tmuxinator"
-isLinux && {
- ,u() {
- cd ~/annex;
- git annex info --fast | grep available;
- cd - > /dev/null;
- }
- export -f ,u
+u() {
+ pushd ~/annex > /dev/null;
+ git annex info --fast | grep available;
+ popd > /dev/null;
}
+export -f u
MY_PS1="$PS1"
ps1() {
diff --git a/bash/fake-symlinks.sh b/bash/fake-symlinks.sh
index 687395a..336f0c5 100644
--- a/bash/fake-symlinks.sh
+++ b/bash/fake-symlinks.sh
@@ -4,17 +4,16 @@ if [[ -n "$GITHUB_TOKEN" ]]; then
cat $DOTFILES/git/gitconfig.ini | envsubst > ~/.gitconfig
fi
-repos=("org.euandreh.misc" "org.euandreh.http")
-for repo in ${repos[@]}; do
- cp "$DOTFILES/git/gitlab-ci.yml" "$DOTFILES/../$repo/.gitlab-ci.yml"
- cp "$DOTFILES/git/default.nix" "$DOTFILES/../$repo/default.nix"
-done
-
-
-SRHT_REPOS=("website" "mentat" "cement" "pouchdb-materialized-view" "pires")
+SRHT_REPOS=("website" "mentat" "cement" "pouchdb-materialized-view" "pires" "superlogin" "superlogin-client")
SRHT_REPOS_PATH="$HOME/dev/libre"
for repo in ${SRHT_REPOS[@]}; do
cat $DOTFILES/templates/sr-ht-build.yaml | REPO="$repo" envsubst > "$SRHT_REPOS_PATH/$repo/.build.yml"
done
+
+for repo in ${SRHT_REPOS[@]}; do
+ if [[ "$repo" != "website" ]]; then
+ cat "$DOTFILES/templates/env.sh" | REPO="$repo" envsubst > "$SRHT_REPOS_PATH/$repo/env.sh"
+ fi
+done
diff --git a/bash/youtube.sh b/bash/youtube.sh
index 6ffb2da..c40e0a7 100644
--- a/bash/youtube.sh
+++ b/bash/youtube.sh
@@ -14,7 +14,7 @@ download() {
youtube-dl "$1" \
--download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \
--prefer-free-formats \
- --playlist-end $2 \
+ --playlist-end "$2" \
--write-description \
--output "$YT_TEMPLATE"
}
@@ -22,19 +22,19 @@ export -f download
download_user() {
- download "https://www.youtube.com/user/$1" ${2-$DEFAULT_PLAYLIST_END}
+ download "https://www.youtube.com/user/$1" "${2-$DEFAULT_PLAYLIST_END}"
}
export -f download_user
download_channel() {
- download "https://www.youtube.com/channel/$1" ${2-$DEFAULT_PLAYLIST_END}
+ download "https://www.youtube.com/channel/$1" "${2-$DEFAULT_PLAYLIST_END}"
}
export -f download_channel
download_playlist() {
- download "https://www.youtube.com/playlist?list=$1" ${2-$DEFAULT_PLAYLIST_END}
+ download "https://www.youtube.com/playlist?list=$1" "${2-$DEFAULT_PLAYLIST_END}"
}
export -f download_playlist
@@ -46,8 +46,10 @@ inc_download() {
local file="$HOME/.yt-db/$id"
mkdir -p "$HOME/.yt-db"
- local n_count="$(cat $file 2> /dev/null || printf 10)"
- local n_count_new="$(($n_count + $step))"
+ n_count="$(cat "$file" 2> /dev/null || printf 10)"
+ local n_count
+ n_count_new="$((n_count + step))"
+ local n_count_new
echo "$n_count_new" > "$file"
diff --git a/templates/env.sh b/templates/env.sh
new file mode 100644
index 0000000..4ff21f2
--- /dev/null
+++ b/templates/env.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+export SERVER_URL=root@euandre.org
+export DOCS_SERVER_PATH="/home/user-data/www/default/$REPO/"