dot

packages and services management
Log | Files | Refs | README

commit 4b9a51bc353b51c7bdede3a3e2aa83442ae04118
parent e4e7f6ceb469512760c379b27613b3e644b9b3ea
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 14 Feb 2018 23:25:40 +0100

[ref] no more {} around every variable name

Diffstat:
Mbin/agenda | 44++++++++++++++++++++++----------------------
Mbin/back | 50+++++++++++++++++++++++++-------------------------
Mbin/blih-openssl | 16++++++++--------
Mbin/clip | 12++++++------
Mbin/collectd-ploot | 35++++++++++++++++++++++++++---------
Mbin/dns-used-tld | 10+++++-----
Mbin/dvtm-status | 12++++++------
Mbin/git-all | 10+++++-----
Mbin/git-gph | 2+-
Mbin/http | 4++--
Mbin/io | 36++++++++++++++++++------------------
Mbin/ipconv | 14+++++++-------
Mbin/irc | 16++++++++--------
Mbin/log | 4++--
Mbin/lt | 2+-
Mbin/mdoc | 2+-
Mbin/mfilter | 16++++++++--------
Dbin/monit | 75---------------------------------------------------------------------------
Mbin/msearch | 2+-
Mbin/mv-sane | 2+-
Mbin/pack | 66+++++++++++++++++++++++++++++++++---------------------------------
Mbin/plot | 2+-
Mbin/qemu | 30+++++++++++++++---------------
Mbin/run | 6+++---
Mbin/ssh-paste | 6+++---
Mbin/status | 6+++---
Mbin/term | 2+-
Mbin/tls | 16++++++++--------
Mbin/tty-theme | 16++++++++--------
Mbin/twt | 70+++++++++++++++++++++++++++++++++++-----------------------------------
Mbin/update-agenda | 4++--
Mbin/update-sfeed | 26+++++++++++++-------------
Mbin/wifi | 4++--
Mbin/xdg-open | 180++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mpack/b2sum/build | 2+-
Mpack/busybox/build | 2+-
Mpack/cgo/build | 6+++---
Mpack/collectd/build | 10+++++-----
Mpack/dash/build | 2+-
Mpack/dwm/build | 6+++---
Mpack/ed/build | 4++--
Mpack/enchive/build | 2+-
Mpack/entr/build | 2+-
Mpack/farbfeld-resize/build | 4++--
Mpack/farbfeld/build | 2+-
Mpack/ffmpeg/build | 2+-
Mpack/git/build | 2+-
Mpack/liblz4/build | 2+-
Mpack/libmusl/build | 12++++++------
Mpack/libopus/build | 3++-
Mpack/libtox/build | 12++++++------
Mpack/man-c++/build | 4++--
Mpack/man-posix/build | 2+-
Mpack/mblaze/build | 2+-
Mpack/minilisp/build | 4++--
Mpack/mpop/build | 10+++++-----
Mpack/msmtp/build | 10+++++-----
Mpack/mupdf/build | 2+-
Mpack/ngircd/build | 6+++---
Mpack/openssh/build | 4++--
Mpack/opentracker/build | 6+++---
Mpack/radare2/build | 2+-
Mpack/reflex/build | 4++--
Mpack/retawq/build | 6+++---
Mpack/rsync/build | 2+-
Mpack/runit/build | 8++++----
Mpack/sfeed/build | 6+++---
Mpack/st/build | 8++++----
Mpack/sup/build | 2+-
Mpack/tcpdump/build | 4++--
Mpack/tinc/build | 8++++----
Mpack/u9fs/build | 2+-
Mpack/xinetd/build | 6+++---
Mrun/collectd | 8++++----
Mrun/crond | 4++--
Mrun/geomyidae | 12++++++------
Mrun/git | 10+++++-----
Mrun/ii | 18+++++++++---------
Mrun/inetd | 4++--
Mrun/irc.cyberia.is | 18+++++++++---------
Mrun/irc.freenode.net | 18+++++++++---------
Mrun/irc.oftc.net | 18+++++++++---------
Mrun/ngircd | 4++--
Mrun/opentracker | 6+++---
Mrun/quark | 8++++----
Mrun/ratox | 10+++++-----
Mrun/ssh-agent | 8++++----
Mrun/tincd | 4++--
Mrun/tor | 4++--
Mrun/unix.chat | 18+++++++++---------
90 files changed, 548 insertions(+), 605 deletions(-)

diff --git a/bin/agenda b/bin/agenda @@ -1,7 +1,7 @@ #!/bin/sh # plain text agenda reading ical with its own simpler format -AGENDA="${AGENDA:-${ETC:-${HOME}/.config}/agenda}" +AGENDA="${AGENDA:-${ETC:-$HOME/.config}/agenda}" awk_date=' @@ -42,7 +42,7 @@ function to_date(fmt, sec) return sprintf(fmt, yrs, mth, day, hrs, min, sec); }' -awk_import="${awk_date}"' +awk_import="$awk_date"' #OFF [+-]HH function ical_date(str, off) { @@ -110,7 +110,7 @@ BEGIN { printf("%s%s\n", prefix, line[i]) | sort; }' -awk_view="${awk_date}"' +awk_view="$awk_date"' #OFF [+-]HH BEGIN { @@ -152,7 +152,7 @@ BEGIN { last_day = b_day; }' -awk_to_sec="${awk_date}"' +awk_to_sec="$awk_date"' #DATE YYYY-MM-DD-HH-MM #OFF=[+-]HH BEGIN { @@ -182,45 +182,45 @@ END { }' -mkdir -p "${AGENDA}" +mkdir -p "$AGENDA" -case "${1}" in +case "$1" in (import) - [ "${#}" -ne 4 ] && exec "${0}" + [ "$#" -ne 4 ] && exec "$0" - awk -v OFF="${4}" "${awk_import}" "${2}" > "${AGENDA}/${3}" + awk -v OFF="$4" "$awk_import" "$2" > "$AGENDA/$3" ;; (view) - [ "${#}" -lt 2 ] || [ "${#}" -gt 3 ] && exec "${0}" + [ "$#" -lt 2 ] || [ "$#" -gt 3 ] && exec "$0" shift 1 - [ "${1}" = 'all' ] && set -- "${AGENDA}"/* || set -- "${AGENDA}/${1}" + [ "$1" = 'all' ] && set -- "$AGENDA"/* || set -- "$AGENDA/$1" - cat "${@}" | - awk -v SORT="${3:-BECLS}" "${awk_sort}" | - awk -v OFF="$(date +%z | cut -c 1-3)" "${awk_view}" | + cat "$@" | + awk -v SORT="${3:-BECLS}" "$awk_sort" | + awk -v OFF="$(date +%z | cut -c 1-3)" "$awk_view" | less ;; (add) - [ "${#}" -ne 4 ] && exec "${0}" + [ "$#" -ne 4 ] && exec "$0" off="$(date +%z | cut -c -3)" printf 'B:%s\nE:%s\nS:\nC:\nL:\nD:\n:\n' \ - "$(awk -v DATE="${3}" -v OFF="${off}" "${awk_to_sec}")" \ - "$(awk -v DATE="${4}" -v OFF="${off}" "${awk_to_sec}")" \ - >> "${AGENDA}/${2}" + "$(awk -v DATE="$3" -v OFF="$off" "$awk_to_sec")" \ + "$(awk -v DATE="$4" -v OFF="$off" "$awk_to_sec")" \ + >> "$AGENDA/$2" - exec "${0}" edit "${2}" + exec "$0" edit "$2" ;; (edit) [ $# -ne 2 ] && exec "$0" - exec $EDITOR "${AGENDA}/$2" + exec $EDITOR "$AGENDA/$2" ;; (gopher) - find "${AGENDA#${PWD}/}" -type f ! -name '*.txt' \ - -exec awk "${awk_gopher}" {} \; | sort + find "${AGENDA#$PWD/}" -type f ! -name '*.txt' \ + -exec awk "$awk_gopher" {} \; | sort ;; (*) echo 'usage: agenda add <name> <YYYY-MM-DD-HH-MM> <YYYY-MM-DD-HH-MM>' @@ -229,6 +229,6 @@ case "${1}" in echo ' agenda view <name> [BESCL]' echo ' agenda gopher' echo '' - ls -C "${AGENDA}" + ls -C "$AGENDA" ;; esac diff --git a/bin/back b/bin/back @@ -1,53 +1,53 @@ #!/bin/sh -e # store data in hash-indexed backups -BACK="${BACK:-${HOME}/back}" +BACK="${BACK:-$HOME/back}" -mkdir -p "${BACK}/0/rev" "${BACK}/0/obj" +mkdir -p "$BACK/0/rev" "$BACK/0/obj" sum='b2sum -l 256' -[ -r "${BACK}/log" ] && -log="${BACK}/0/rev/$(sed -n '$ s/[^ ]* // p' "${BACK}/log")" +[ -r "$BACK/log" ] && +log="$BACK/0/rev/$(sed -n '$ s/[^ ]* // p' "$BACK/log")" -case "${1}" in +case "$1" in (up) - [ -e "${BACK}/0/new" ] && exit 1 + [ -e "$BACK/0/new" ] && exit 1 find . -type f '(' \ - -exec test "${log}" -nt {} ';' \ - -exec grep -F {} "${log}" ';' -o \ - -exec ${sum} {} + \ + -exec test "$log" -nt {} ';' \ + -exec grep -F {} "$log" ';' -o \ + -exec $sum {} + \ ')'| - tee "${BACK}/0/new" | + tee "$BACK/0/new" | while read -r hash path do - [ -f "${BACK}/0/obj/${hash}.lz4" ] || - lz4 -vq "${path}" "${BACK}/0/obj/${hash}.lz4" + [ -f "$BACK/0/obj/$hash.lz4" ] || + lz4 -vq "$path" "$BACK/0/obj/$hash.lz4" done - sort "${BACK}/0/new" -o "${BACK}/0/new" - rev="$(${sum} "${BACK}/0/new" | sed 's/ .*//')" - mv "${BACK}/0/new" "${BACK}/0/rev/${rev}" - date +"%Y-%m-%d-%H-%M-%S ${rev}" >> ${BACK}/log + sort "$BACK/0/new" -o "$BACK/0/new" + rev="$($sum "$BACK/0/new" | sed 's/ .*//')" + mv "$BACK/0/new" "$BACK/0/rev/$rev" + date +"%Y-%m-%d-%H-%M-%S $rev" >> $BACK/log ;; (to) - more "${BACK}/0/rev/${2}" - printf 'apply %s? [Y/n] ' "${2}" 1>&2 + more "$BACK/0/rev/$2" + printf 'apply %s? [Y/n] ' "$2" 1>&2 case "$(sed q)" in (y|Y|'') ;; (*) exit 0 ;; esac find . -mindepth 1 -maxdepth 1 -exec rm -r {} + while read -r hash path do - mkdir -p "$(dirname "${path}")" - lz4 -q "${BACK}/0/obj/${hash}.lz4" "${path}" - done < "${BACK}/0/rev/${2}" + mkdir -p "$(dirname "$path")" + lz4 -q "$BACK/0/obj/$hash.lz4" "$path" + done < "$BACK/0/rev/$2" ;; (log) - less "${BACK}/log" + less "$BACK/log" ;; (rsync) - rsync --size-only -vr "${2}/" "${BACK}/0/" - rsync --size-only -vr "${BACK}/0/" "${2}/" + rsync --size-only -vr "$2/" "$BACK/0/" + rsync --size-only -vr "$BACK/0/" "$2/" ;; (*) echo 'usage: back up' @@ -58,4 +58,4 @@ case "${1}" in ;; esac -find "${BACK}/0/obj" -type f -exec chmod -w {} + +find "$BACK/0/obj" -type f -exec chmod -w {} + diff --git a/bin/blih-openssl b/bin/blih-openssl @@ -1,7 +1,7 @@ #!/bin/sh # bocal lightweight interface for human client -usr="${BLIH}" +usr="$BLIH" host='blih.epitech.eu' printf 'password: ' 1>&2 @@ -10,24 +10,24 @@ IFS='' read -r pwd stty echo printf '\n' -tok="$(printf %s "${pwd}" | openssl dgst -sha512 | cut -d ' ' -f 2)" -sig="$(printf %s "${usr}" | openssl dgst -sha512 -hmac "${tok}" | +tok="$(printf %s "$pwd" | openssl dgst -sha512 | cut -d ' ' -f 2)" +sig="$(printf %s "$usr" | openssl dgst -sha512 -hmac "$tok" | cut -d ' ' -f 2)" -data="{\"user\": \"${usr}\", \"signature\": \"${sig}\"}" +data="{\"user\": \"$usr\", \"signature\": \"$sig\"}" method='GET' -request="${1}" +request="$1" -openssl s_client -connect "${host}:443" -quiet 2> /dev/null \ +openssl s_client -connect "$host:443" -quiet 2> /dev/null \ << EOF | sed '1,/^.$/d' $method //$request HTTP/1.1 Accept-Encoding: identity -Content-Length: ${#data} +Content-Length: $#data Host: $host Content-Type: application/json User-Agent: blih-1.7 Connection: close -${data} +$data EOF printf '\n' diff --git a/bin/clip b/bin/clip @@ -1,17 +1,17 @@ #!/bin/sh -e -CLIP="${CLIP:-${HOME}/.cache/clip}" +CLIP="${CLIP:-$HOME/.cache/clip}" -touch "${CLIP}" -chmod 600 "${CLIP}" +touch "$CLIP" +chmod 600 "$CLIP" -case "${1}" in +case "$1" in (-i) shift - cat "${@}" > "${CLIP}" + cat "$@" > "$CLIP" ;; (-o) - cat "${CLIP}" + cat "$CLIP" ;; (*) echo 'usage: clip -i [file...]' diff --git a/bin/collectd-ploot b/bin/collectd-ploot @@ -4,42 +4,59 @@ mkdir -p stat -find "$(cd "${1}"; pwd)" -mindepth 2 -maxdepth 2 | sort | +find "$(cd "$1"; pwd)" -mindepth 3 -maxdepth 3 -type f | sort | sed -r 's:.*/([^/]+/[^/]+)-([0-9]+-[0-9]+-[0-9]+)$:\1/\2:' | while IFS='/' read -r node category stat do - printf '%s - %s - %s\n' "${node}" "${category}" "${stat}" + printf '%s - %s - %s\n' "$node" "$category" "$stat" done +awk ' +NR == 1 { + sub("-[0-9]+-[0-9]+-[0-9]+$", "", FILENAME); + filename = FILENAME; + sub("/[^/]*$", "", FILENAME); + + n = split($0, head, ","); + for (i = 2; i <= n; i++) + name[i] = +} + +NR > 1 { + n = split($0, vals, ","); + for (i = 2; i <= n; i++) + printf("%s\t%s\n", vals[1], vals[i]) >> filename "-" head[i]; +}' + exit -for host in "${1}"/* +for host in "$1"/* do { printf '\n' sed '1 d; s/,/ /' \ - "${host}/cpu/percent-idle-$(date +%Y-%m-%d)" | + "$host/cpu/percent-idle-$(date +%Y-%m-%d)" | ploot -o 10 -t 'cpu idle %' sed '1 d; s/,/ /' \ - "${host}/cpu/percent-user-$(date +%Y-%m-%d)" | + "$host/cpu/percent-user-$(date +%Y-%m-%d)" | ploot -o 10 -t 'cpu user %' sed '1 d; s/,/ /' \ - "${host}/cpu/percent-system-$(date +%Y-%m-%d)" | + "$host/cpu/percent-system-$(date +%Y-%m-%d)" | ploot -o 10 -t 'cpu system %' sed '1 d; s/,/ /' \ - "${host}/cpu/percent-interrupt-$(date +%Y-%m-%d)" | + "$host/cpu/percent-interrupt-$(date +%Y-%m-%d)" | ploot -o 10 -t 'cpu interrupt %' sed '1 d; s/,/ /g' \ - "${host}/load/load-relative-$(date +%Y-%m-%d)" | + "$host/load/load-relative-$(date +%Y-%m-%d)" | cut -d' ' -f1-2 | ploot -o 10 -t 'load average' printf '\n' - } > "${2}/$(basename "${host}")" + } > "$2/$(basename "$host")" done diff --git a/bin/dns-used-tld b/bin/dns-used-tld @@ -1,7 +1,7 @@ #!/bin/sh # list all used TLD for a given SLD -if [ "${#}" -ne 1 ] +if [ "$#" -ne 1 ] then echo 'usage: dns-used-tld <segond-level-domain>' exit 0 @@ -19,20 +19,20 @@ sed '1d' > '/tmp/tlds-alpha-by-domain.txt' if [ ! -f '/tmp/tlds-false-positive.txt' ] then touch /tmp/tlds-false-positive.txt - "${0}" "$(tr -cd 0-9a-z < /dev/urandom | + "$0" "$(tr -cd 0-9a-z < /dev/urandom | dd bs=32 count=1 2> /dev/null)" > /tmp/tlds-false-positive.txt fi i=0 while read tld do - dig -t NS "${1}.${tld}" | awk '/^[^;]/ && $3 == "IN" { + dig -t NS "$1.$tld" | awk '/^[^;]/ && $3 == "IN" { gsub("[^.]", "", $1) if (length($1) <= 1) exit 0 exit 1 - }' || printf '%s\n' "${tld}" & + }' || printf '%s\n' "$tld" & - [ "${i}" = 5 ] && wait + [ "$i" = 5 ] && wait i="$((i + 1))" done << EOF $(grep -vFf /tmp/tlds-false-positive.txt /tmp/tlds-alpha-by-domain.txt) diff --git a/bin/dvtm-status b/bin/dvtm-status @@ -1,16 +1,16 @@ #!/bin/sh -FIFO="${RUN}/dvtm-status.${$}" +FIFO="$RUN/dvtm-status.${$}" -[ -p "${FIFO}" ] || mkfifo -m 600 "${FIFO}" || exit 1 +[ -p "$FIFO" ] || mkfifo -m 600 "$FIFO" || exit 1 while true do - printf '%s\n' "$(status)" > "${FIFO}" + printf '%s\n' "$(status)" > "$FIFO" sleep 10 done & PID="${!}" dvtm -s "$FIFO" "$@" 2> /dev/null -kill "${PID}" -wait "${PID}" 2> /dev/null -rm -f "${FIFO}" +kill "$PID" +wait "$PID" 2> /dev/null +rm -f "$FIFO" diff --git a/bin/git-all b/bin/git-all @@ -1,8 +1,8 @@ #!/bin/sh -find "${HOME}" -name .git -exec sh -c ' +find "$HOME" -name .git -exec sh -c ' cd "${0%/.git}" - printf "\\n%-50s" "${PWD}" 2>&1 - git status -s --branch --color=always 2>&1 - "${@}" -' {} "${@}" \; + printf "\\n%-50s" "$PWD" 2>&1 + git status -s --branch 2>&1 + "$@" +' {} "$@" \; diff --git a/bin/git-gph b/bin/git-gph @@ -7,7 +7,7 @@ cat << EOF > index.gph --- $(basename "$(pwd)") --- - git clone git://josuah.net:9000/$(basename "${PWD}") + git clone git://josuah.net:9000/$(basename "$PWD") $(git ls-tree -r --name-only master | sort | sed 's/^/ /') diff --git a/bin/http b/bin/http @@ -1,6 +1,6 @@ #!/bin/sh -case "${1}" in +case "$1" in (0x0) curl -F file=@- 0x0.st ;; @@ -11,7 +11,7 @@ case "${1}" in curl -F f:1=@- ix.io ;; (rfc) - curl -L "http://www.ietf.org/rfc/rfc${1}".txt | ${PAGER} + curl -L "http://www.ietf.org/rfc/rfc$1".txt | $PAGER ;; (sprunge) curl -F sprunge=@- sprunge.us diff --git a/bin/io b/bin/io @@ -6,18 +6,18 @@ export LC_COLLATE='C' cmd="${1:-open}" [ "$#" -gt 0 ] && shift -case "${cmd}" in +case "$cmd" in (a|abduco) - if [ "${#}" -gt 0 ] + if [ "$#" -gt 0 ] then - id="${1}" + id="$1" shift else id=$({ printf '#'; abduco; } | iomenu -# | cut -f4) fi - [ "${SSH_TTY}" ] && e='^Z' || e='^\' - [ "${id}" ] && ABDUCO="${id}" exec abduco -e "${e}" -A "${id}" "${@}" + [ "$SSH_TTY" ] && e='^Z' || e='^\' + [ "$id" ] && ABDUCO="$id" exec abduco -e "$e" -A "$id" "$@" ;; (f|find) find "${@:-.}" -name .git -prune -o -print | iomenu @@ -68,21 +68,21 @@ EOF netstat -na | sed 's/^[AP]/#&/' | iomenu -# ;; (o|open) - cache="${HOME}/.cache/find" - mkdir -p "${cache}" + cache="$HOME/.cache/find" + mkdir -p "$cache" - case "${PWD}" in ("${HOME}"/*) - dir=$(printf %s "${PWD##${HOME}/}" | sed 's|/.*||') - find "${HOME}/$dir" '(' -name .git -o -name CVS ')' -prune -o -print | - sort > "${cache}/${dir}" + case "$PWD" in ("$HOME"/*) + dir=$(printf %s "${PWD##$HOME/}" | sed 's|/.*||') + find "$HOME/$dir" '(' -name .git -o -name CVS ')' -prune -o -print | + sort > "$cache/$dir" esac - exec xdg-open "$(find "${HOME}" -maxdepth 1 -mindepth 1 | + exec xdg-open "$(find "$HOME" -maxdepth 1 -mindepth 1 | sort | - cut -c $((${#HOME} + 2))- | - xargs -I {} printf '%s/%s\n' "${cache}" {} | - xargs -I {} cat "${cache}" {} 2> /dev/null | - cat - "${ETC}/uri" | + cut -c $(($#HOME + 2))- | + xargs -I {} printf '%s/%s\n' "$cache" {} | + xargs -I {} cat "$cache" {} 2> /dev/null | + cat - "$ETC/uri" | iomenu -# | cut -f 2-)" ;; @@ -101,13 +101,13 @@ EOF } | iomenu -# ;; (s|sfeed) - exec xdg-open "$(find "${HOME}/.sfeed/feeds" -type f \ + exec xdg-open "$(find "$HOME/.sfeed/feeds" -type f \ -exec sfeed_plain {} + | sort -k 2 -t ' ' | iomenu | sed 's/.* //')" ;; (*) printf 'usage: %s ' "${0##*/}" - sed -n '/^(/ { s/^(//; s/)$//; s/|.\(.*\)/[\1]/; /^\*$/d; p; }' "${0}" | + sed -n '/^(/ { s/^(//; s/)$//; s/|.\(.*\)/[\1]/; /^\*$/d; p; }' "$0" | tr '\n' '|' | sed 's/|/ | /g' | fold -sw 60 | sed 's/^[ |]*//; s/[ |]*$//; 2,$ s/^/ /' printf '\n' diff --git a/bin/ipconv b/bin/ipconv @@ -1,25 +1,25 @@ #!/bin/sh -if [ -z "${1}" ] || [ "${#}" -ne 1 ] +if [ -z "$1" ] || [ "$#" -ne 1 ] then exit 1 elif [ -z "$(printf %s "$1" | tr -d 0-9)" ] then - int="${1}" ip='' + int="$1" ip='' for i in 1 2 3 4 do - ip=".$((int & 255))${ip}" + ip=".$((int & 255))$ip" int="$((int >> 8))" done - printf '%s\n' "${ip#?}" -elif [ -z "$(printf %s "${1}" | tr -d 0-9.)" ] + printf '%s\n' "$ip#?" +elif [ -z "$(printf %s "$1" | tr -d 0-9.)" ] then int=0 IFS=. - for byte in ${1} + for byte in $1 do int="$(((int << 8) + byte))" done - printf '%s\n' "${int}" + printf '%s\n' "$int" else printf 'unknown address format\n' exit 1 diff --git a/bin/irc b/bin/irc @@ -1,16 +1,16 @@ #!/bin/sh # ii client with iomenu(1) (selection), eel(1) (formatting), srw(1) (input) -if [ "${#}" -eq 1 ] +if [ "$#" -eq 1 ] then - [ "${1}" ] || exit 1 - eel < "${1}/out" | less - srw -p "${1##${VAR}/irc/}> " sh -c ' - tail -n 80 -f "${0}/out" | eel & - cat > "${0}/in" - ' "${1}" + [ "$1" ] || exit 1 + eel < "$1/out" | less + srw -p "${1##$VAR/irc/}> " sh -c ' + tail -n 80 -f "$0/out" | eel & + cat > "$0/in" + ' "$1" fi trap '' INT -exec "${0}" "$(find "${VAR}/irc" -mindepth 1 -type d | iomenu)" +exec "$0" "$(find "$VAR/irc" -mindepth 1 -type d | iomenu)" diff --git a/bin/log b/bin/log @@ -1,5 +1,5 @@ #!/bin/sh -[ "${#}" -ge 1 ] || exec ls "${CFG}/run" +[ "$#" -ge 1 ] || exec ls "$CFG/run" -exec less "${VAR}/log/$1" +exec less "$VAR/log/$1" diff --git a/bin/lt b/bin/lt @@ -45,4 +45,4 @@ END { printf("%s", line_v[l":"i]); printf("%s\n", line_v[l"name"]); } -}' | ${PAGER} +}' | $PAGER diff --git a/bin/mdoc b/bin/mdoc @@ -1,6 +1,6 @@ #!/bin/sh -case "${1}" in +case "$1" in (dd) date +'.Dd $Mdocdate: %B %d %Y$' ;; diff --git a/bin/mfilter b/bin/mfilter @@ -1,16 +1,16 @@ #!/bin/sh # read and filter mails using mblaze -minc "${VAR}/mail/INBOX" | mseq -S +minc "$VAR/mail/INBOX" | mseq -S -[ "${1}" = '-a' ] && mdirs "${VAR}/mail" | mlist | mseq -S +[ "$1" = '-a' ] && mdirs "$VAR/mail" | mlist | mseq -S while read -r dir header glob do - mkdir -p "${VAR}/mail/${dir}/cur" \ - "${VAR}/mail/${dir}/new" \ - "${VAR}/mail/${dir}/tmp" - printf '%-25s' "${dir}" + mkdir -p "$VAR/mail/$dir/cur" \ + "$VAR/mail/$dir/new" \ + "$VAR/mail/$dir/tmp" + printf '%-25s' "$dir" mseq : | mpick -t "$header ~~~ $glob" | - xargs -rI {} mv {} "${VAR}/mail/${dir}/new" -done < "${ETC}/mblaze/filter" + xargs -rI {} mv {} "$VAR/mail/$dir/new" +done < "$ETC/mblaze/filter" diff --git a/bin/monit b/bin/monit @@ -1,75 +0,0 @@ -#!/bin/sh -# ressources monitoring script for plotting with ploot(1) - -# It will produce one line with the following values, separated with a space: -# -# 1. hostname 5. load average (1 minute) -# 2. unix time 6. disk I/O -# 3. free memory 7. total free storage -# 4. cpu usage - -MONIT="${VAR}/monit" - -awk_record=' -#mem -#bi -#bo - -NR == 2 { - split($0, keys); - for (key in keys) - if (keys[key] ~ /[0-9]$/) - disks[i++] = keys[key]; -} - -NR >= 4 { - while ("df" | getline) { - if ($1 ~ "^/dev/" || $1 == "zroot") - stor += $4; - } - - "date +%s" | getline time; close("date +%s"); - "hostname" | getline host; close("hostname"); - "uptime" | getline load; close("uptime"); - - sub(/.* /, "", load); - for (i = 1 + split($0, values); i > 0; i--) - table[keys[i]] = values[i]; - mem = table[mem]; - cpu = 100 - table['id']; - load = load; - diskio = table[bi] + table[bo]; - for (disk in disks) - diskio += table[disks[disk]]; - print(time " " mem " " cpu " " load " " diskio " " stor); - fflush(); -}' - -case "$(uname)" in -(Linux) mem='free' bi='bi' bo='bo' ;; -(*BSD) mem='fre' bi='' bo='' ;; -(Solaris) mem='free' bi='' bo='' ;; -(SunOS) mem='free' bi='' bo='' ;; -esac - -case "${1}" in -(record) - [ "${#}" -ne 2 ] && exec "${0}" - vmstat "${2}" | - awk -v mem="${mem}" -v bi="${bi}" -v bo="${bo}" "${awk_record}" \ - >> "${MONIT}" - ;; -(step) - [ "${#}" -ne 2 ] && exec "${0}" - vmstat "${2}" 2 | - awk -v mem="${mem}" -v bi="${bi}" -v bo="${bo}" "${awk_record}" >> "${MONIT}" - ;; -(plot) - [ "${#}" -ne 2 ] && [ "${#}" -ne 3 ] && exec "${0}" - cut -d ' ' -f 2,7 "${MONIT}" | sed 's/ /,/' | - ploot -o "${2:?step required}" - ;; -(*) - echo 'usage: monit step | record | plot delay' - ;; -esac diff --git a/bin/msearch b/bin/msearch @@ -1,3 +1,3 @@ #!/bin/sh -e -mdirs "${VAR}/mail" | mlist | mpick "${@}" | mseq -S | mscan +mdirs "$VAR/mail" | mlist | mpick "$@" | mseq -S | mscan diff --git a/bin/mv-sane b/bin/mv-sane @@ -7,5 +7,5 @@ do tr '\t #&;*?<>|"()[]{}\\-=+'\' _ | sed -e 's/__*/_/g' -e 's/^_//' -e 's/_$//')" - [ "${new}" = "${path}" ] || mv "${path}" "${new}" + [ "$new" = "$path" ] || mv "$path" "$new" done diff --git a/bin/pack b/bin/pack @@ -1,65 +1,65 @@ #!/bin/sh -e -export PKG="${CFG}/pack/${2}" -export SRC="${SYS}/src/${2}" -export OPT="${SYS}/opt/${2}" -export CFLAGS="-I'${SYS}/include'" -export LDFLAGS="-L'${SYS}/lib'" +export PKG="$CFG/pack/$2" +export SRC="$SYS/src/$2" +export OPT="$SYS/opt/$2" +export CFLAGS="-I'$SYS/include'" +export LDFLAGS="-L'$SYS/lib'" -case "${1}" in +case "$1" in (tar) - [ -d "${SRC}" ] && exit 0 || mkdir -p "${SRC}" + [ -d "$SRC" ] && exit 0 || mkdir -p "$SRC" - IFS='' read -r url < "${PKG}/tar" + IFS='' read -r url < "$PKG/tar" - curl -#L "${url}" | case "${url}" in + curl -#L "$url" | case "$url" in (*.tgz|*.tar.gz) gzip -d - ;; (*.tbz|*.tar.bz2) bzip2 -d - ;; (*.txz|*.tar.xz) xz -d - ;; - esac | tar -xf - -C "${SRC}" || rmdir "${SRC}" + esac | tar -xf - -C "$SRC" || rmdir "$SRC" - find "${SRC}" -mindepth 2 -maxdepth 2 -exec mv {} "${SRC}" ';' - rmdir "${SRC}"/* 2>/dev/null || true + find "$SRC" -mindepth 2 -maxdepth 2 -exec mv {} "$SRC" ';' + rmdir "$SRC"/* 2>/dev/null || true ;; (git) - [ -d "${SRC}" ] && exit 0 + [ -d "$SRC" ] && exit 0 - mkdir -p "$(dirname "${SRC}")" - IFS='' read -r url < "${PKG}/git" - git clone "${url}" "${SRC}" + mkdir -p "$(dirname "$SRC")" + IFS='' read -r url < "$PKG/git" + git clone "$url" "$SRC" ;; (get) - [ -f "${PKG}/tar" ] && exec "${0}" tar "${2}" - [ -f "${PKG}/git" ] && exec "${0}" git "${2}" + [ -f "$PKG/tar" ] && exec "$0" tar "$2" + [ -f "$PKG/git" ] && exec "$0" git "$2" exit 1 ;; (build) - [ -d "${SRC}" ] || "${0}" get "${2}" + [ -d "$SRC" ] || "$0" get "$2" - cd "${SRC}" || exit 1 - mkdir -p "${OPT}" + cd "$SRC" || exit 1 + mkdir -p "$OPT" - [ -f "${PKG}/build" ] && exec sh -ex "${PKG}/build" - [ -f "${PKG}/config.mk" ] && cp "${PKG}/config.mk" "${SRC}" - [ -f "${PKG}/config.h" ] && cp "${PKG}/config.h" "${SRC}" - [ -f "${SRC}/configure" ] && "${SRC}/configure" --prefix="${OPT}" - cd "${SRC}" && make && make PREFIX="${OPT}" install + [ -f "$PKG/build" ] && exec sh -ex "$PKG/build" + [ -f "$PKG/config.mk" ] && cp "$PKG/config.mk" "$SRC" + [ -f "$PKG/config.h" ] && cp "$PKG/config.h" "$SRC" + [ -f "$SRC/configure" ] && "$SRC/configure" --prefix="$OPT" + cd "$SRC" && make && make PREFIX="$OPT" install ;; (add) - [ -d "${OPT}" ] || "${0}" build "${2}" || rm -r "${OPT}" + [ -d "$OPT" ] || "$0" build "$2" || rm -r "$OPT" - cd "${OPT}" && exec find * -type d \ - -exec mkdir -p "${SYS}/{}" \; -o \ - -exec ln -sf "${OPT}/{}" "${SYS}/{}" \; + cd "$OPT" && exec find * -type d \ + -exec mkdir -p "$SYS/{}" \; -o \ + -exec ln -sf "$OPT/{}" "$SYS/{}" \; ;; (del) - rm -rf "${OPT}" - find -L "${SYS}" -name opt -prune -o -name src -prune -o \ + rm -rf "$OPT" + find -L "$SYS" -name opt -prune -o -name src -prune -o \ -type l -exec rm {} + ;; (*) echo 'usage: pack tar | git | get | build | add | del <package>' echo '' - COLUMNS=80 ls "${CFG}/pack" + COLUMNS=80 ls "$CFG/pack" ;; esac diff --git a/bin/plot b/bin/plot @@ -39,4 +39,4 @@ BEGIN { printf("%s", skip[x] ? "x" : "-"); print("+ " x_max); print("\n"); -}' "${@}" +}' "$@" diff --git a/bin/qemu b/bin/qemu @@ -1,45 +1,45 @@ #!/bin/sh -e -mkdir -p "${LOG}/qemu" "${VAR}/qemu" "${LIB}/iso/qemu" +mkdir -p "$LOG/qemu" "$VAR/qemu" "$LIB/iso/qemu" -case "${1}" in +case "$1" in (new) - [ "${#}" -ne 3 ] || ! [ -r "${LIB}/iso/qemu/${3}" ] || - exec "${0}" + [ "$#" -ne 3 ] || ! [ -r "$LIB/iso/qemu/$3" ] || + exec "$0" - cp "${LIB}/iso/qemu/${2}" "${VAR}/qemu/${3}" + cp "$LIB/iso/qemu/$2" "$VAR/qemu/$3" ;; (start) - [ "${#}" -ne 3 ] || ! [ -r "${LIB}/iso/qemu/${2}" ] || - exec "${0}" + [ "$#" -ne 3 ] || ! [ -r "$LIB/iso/qemu/$2" ] || + exec "$0" beg='10000' end='10100' - port="$(netstat -natl | awk -v b="${beg}" -v e="${end}" \ + port="$(netstat -natl | awk -v b="$beg" -v e="$end" \ '$6 == "LISTEN" && sub(".*[.:]", "", $4) && b <= $4 + 0 && $4 + 0 <= e { print($4); }' | sort -ru | sed q)" - port="${port:+$((${port} + 1))}" - port="${port:-${beg}}" + port="${port:+$(($port + 1))}" + port="${port:-$beg}" exec nohup qemu-system-x86_64 \ -m 500M \ -device e1000,netdev=net0 \ - -netdev user,id=net0,hostfwd=tcp::${port}-:22 \ + -netdev user,id=net0,hostfwd=tcp::$port-:22 \ -display none \ - "${VAR}/qemu/${2}" \ - 1>> "${LOG}/qemu/${2}" & + "$VAR/qemu/$2" \ + 1>> "$LOG/qemu/$2" & ;; (*) echo 'usage: qemu start <name.img>' 1>&2 echo ' qemu new <ref.img> <new.img>' 1>&2 echo 'store:' 1>&2 - ls "${LIB}/iso/qemu" | sed 's/^/ /' 1>&2 + ls "$LIB/iso/qemu" | sed 's/^/ /' 1>&2 echo 'created:' 1>&2 - ls "${VAR}/qemu" | sed 's/^/ /' 1>&2 + ls "$VAR/qemu" | sed 's/^/ /' 1>&2 echo 'running:' 1>&2 { diff --git a/bin/run b/bin/run @@ -1,7 +1,7 @@ #!/bin/sh -e -mkdir -p "${LOG}" +mkdir -p "$LOG" -[ "${#}" -ge 1 ] || exec ls "${CFG}/run" +[ "$#" -ge 1 ] || exec ls "$CFG/run" -exec "${CFG}/run/$@" +exec "$CFG/run/$@" diff --git a/bin/ssh-paste b/bin/ssh-paste @@ -1,8 +1,8 @@ #!/bin/sh -cat "${@}" | ssh josuah@josuah.net ' +cat "$@" | ssh josuah@josuah.net ' set -e cd srv/p && tmp=$(mktemp XXXXX.txt) - cat > "${tmp}" - printf %s "${tmp}" + cat > "$tmp" + printf %s "$tmp" ' | sed 's|.*|gopher://josuah.net/0/p/&|' diff --git a/bin/status b/bin/status @@ -12,9 +12,9 @@ case "$(uname)" in sysctl hw.sensors | sed -nr 's/.*(acpibat.).*/\1/p' | sort -u | while IFS='' read -r bat do - max="$(sysctl -n "hw.sensors.${bat}.watthour4" | tr -cd 0-9)" - cur="$(sysctl -n "hw.sensors.${bat}.watthour3" | tr -cd 0-9)" - expr "${cur}" '*' 100 / "${max}" + max="$(sysctl -n "hw.sensors.$bat.watthour4" | tr -cd 0-9)" + cur="$(sysctl -n "hw.sensors.$bat.watthour3" | tr -cd 0-9)" + expr "$cur" '*' 100 / "$max" done ;; esac | xargs printf ' %s%%' diff --git a/bin/term b/bin/term @@ -1,6 +1,6 @@ #!/bin/sh -case "${1}" in +case "$1" in (inv) printf '\033[?5h' ;; diff --git a/bin/tls b/bin/tls @@ -1,16 +1,16 @@ #!/bin/sh -case "${1}" in +case "$1" in (update) - [ "${#}" -eq 2 ] || exec "${0}" + [ "$#" -eq 2 ] || exec "$0" set -ex - mkdir -p "$(dirname "${2}")" + mkdir -p "$(dirname "$2")" openssl req -x509 -newkey rsa:4096 -days 365 \ - -keyout "${2}.key" -out "${2}.pem" - chmod 400 "${2}.key" - chmod 444 "${2}.pem" - openssl dhparam -out "${2}.dhp" 4096 - chmod 444 "${2}.dhparams.pem" + -keyout "$2.key" -out "$2.pem" + chmod 400 "$2.key" + chmod 444 "$2.pem" + openssl dhparam -out "$2.dhp" 4096 + chmod 444 "$2.dhparams.pem" ;; (*) echo 'usage: tls <update> <path>' diff --git a/bin/tty-theme b/bin/tty-theme @@ -18,20 +18,20 @@ printf '\033[H\033[J' while read -r color hex do - if [ "${hex}" ] + if [ "$hex" ] then - printf '\033]P%s%s' "${color}" "${hex}" + printf '\033]P%s%s' "$color" "$hex" show='1' - elif [ "${color}" ] + elif [ "$color" ] then - name="${color}" - elif [ "${show}" -eq 1 ] + name="$color" + elif [ "$show" -eq 1 ] then - printf '\033[K%3s %-20s' "${i}" "${name}" + printf '\033[K%3s %-20s' "$i" "$name" for color in 0 1 2 3 4 5 6 7 do - printf ' \033[3%sm___\033[1m___\033[m' "${color}" + printf ' \033[3%sm___\033[1m___\033[m' "$color" done printf '\n\033[K\n' @@ -39,7 +39,7 @@ do i="$((i + 1))" fi - [ "${1}" ] && [ "${i}" -ge "${1}" ] && return 0 + [ "$1" ] && [ "$i" -ge "$1" ] && return 0 done << EOF lolidaisuki diff --git a/bin/twt b/bin/twt @@ -2,7 +2,7 @@ # twtxt client in a single small POSIX shell script NICK='josuah' -TWT="${HOME}/srv/twtxt.txt" +TWT="$HOME/srv/twtxt.txt" awk_line=' @@ -83,70 +83,70 @@ awk_show=' err() { - printf 'Error: %s\n' "${1}" + printf 'Error: %s\n' "$1" exit 1 } -mkdir -p "${VAR}/twt" -touch "${ETC}/twt" +mkdir -p "$VAR/twt" +touch "$ETC/twt" -case "${1}" in +case "$1" in (tweet) - [ "${#}" -ne 2 ] && exec "${0}" + [ "$#" -ne 2 ] && exec "$0" - msg=$(printf %s "${2}" | sed 's|[^ ]*://[^ ]*|@<&>|' | tr '\n' ' ') + msg=$(printf %s "$2" | sed 's|[^ ]*://[^ ]*|@<&>|' | tr '\n' ' ') while read -r usr url do - url=$(printf %s "${url}" | sed 's/[&/\]/\\&/g') - new=$(printf %s "${usr}" | sed 's/[&/\]/\\&/g') - usr=$(printf %s "${usr}" | sed 's/./[&]/g') - msg=$(printf %s "${msg}" | sed "s/@${usr}/@<${new} ${url}>/") - done < "${ETC}/twt" - printf '%s\t%s\n' "$(date +'%Y-%m-%dT%T%z' | sed 's/..$/:&/')" "${msg}" \ - >> "${TWT}" + url=$(printf %s "$url" | sed 's/[&/\]/\\&/g') + new=$(printf %s "$usr" | sed 's/[&/\]/\\&/g') + usr=$(printf %s "$usr" | sed 's/./[&]/g') + msg=$(printf %s "$msg" | sed "s/@$usr/@<$new $url>/") + done < "$ETC/twt" + printf '%s\t%s\n' "$(date +'%Y-%m-%dT%T%z' | sed 's/..$/:&/')" "$msg" \ + >> "$TWT" ;; (view) - [ "${#}" -ne 2 ] && exec "${0}" - [ -f "${VAR}/twt/${2}" ] || err "${2} feed not found, try update" + [ "$#" -ne 2 ] && exec "$0" + [ -f "$VAR/twt/$2" ] || err "$2 feed not found, try update" - awk "${awk_line}" "${VAR}/twt/${2}" | sort -r | awk "${awk_show}" | ${PAGER} + awk "$awk_line" "$VAR/twt/$2" | sort -r | awk "$awk_show" | $PAGER ;; (timeline) - [ "${#}" -ne 1 ] && exec "${0}" - ls "${VAR}/twt"/* 2> /dev/null 1>&2 || err 'no feed found, try to update' + [ "$#" -ne 1 ] && exec "$0" + ls "$VAR/twt"/* 2> /dev/null 1>&2 || err 'no feed found, try to update' - awk "${awk_line}" "${VAR}/twt"/* | sort -r | awk "${awk_show}" | ${PAGER} + awk "$awk_line" "$VAR/twt"/* | sort -r | awk "$awk_show" | $PAGER ;; (update) while read -r usr url do - curl -m 10 -#L "${url}" > "${VAR}/twt/${usr}" || - rm "${VAR}/twt/${usr}" & - done < "${ETC}/twt" + curl -m 10 -#L "$url" > "$VAR/twt/$usr" || + rm "$VAR/twt/$usr" & + done < "$ETC/twt" wait ;; (follow) - [ "${#}" -ne 3 ] && exec "${0}" + [ "$#" -ne 3 ] && exec "$0" - sed 's/[[:space:]].*//' "${ETC}/twt" | grep -Fqx "${2}" && - err "already following ${2}" + sed 's/[[:space:]].*//' "$ETC/twt" | grep -Fqx "$2" && + err "already following $2" - printf '%s\t%s\n' "${2}" "${3}" >> "${ETC}/twt" - sort -uo "${ETC}/twt" "${ETC}/twt" + printf '%s\t%s\n' "$2" "$3" >> "$ETC/twt" + sort -uo "$ETC/twt" "$ETC/twt" ;; (unfollow) - [ "${#}" -ne 2 ] && exec "${0}" - sed 's/[[:space:]].*//' "${ETC}/twt" | grep -Fqx "${2}" || - err "not following ${2}" + [ "$#" -ne 2 ] && exec "$0" + sed 's/[[:space:]].*//' "$ETC/twt" | grep -Fqx "$2" || + err "not following $2" - sed "/^$(printf %s "${2}" | sed 's/./[&]/g')[[:space:]]/ d" "${ETC}/twt" | - sort -uo "${ETC}/twt" + sed "/^$(printf %s "$2" | sed 's/./[&]/g')[[:space:]]/ d" "$ETC/twt" | + sort -uo "$ETC/twt" ;; (following) - [ "${#}" -ne 1 ] && exec "${0}" + [ "$#" -ne 1 ] && exec "$0" sed -r 's/[[:space:]]/ /; s/(.{12}[^ ]*) */\1 @ /' \ - "${ETC}/twt" + "$ETC/twt" ;; (*) printf 'usage: twt [tweet msg | view user | timeline | update\n' diff --git a/bin/update-agenda b/bin/update-agenda @@ -2,8 +2,8 @@ printf '%s\n' epitech url='https://intra.epitech.eu/auth-251e3d0bfcea8ed69a5581361a6a5b8b7ac3cfd5/planning/load?format=ical&location=FR/REN&onlymypromo=true&onlymymodule=true&semester=0,1,10,2,3,4,5,6,7,8,9' -curl -#L "${url}" | agenda import - epitech +01 +curl -#L "$url" | agenda import - epitech +01 printf '%s\n' fosdem url='https://fosdem.org/2018/schedule/ical' -curl -#L "${url}" | agenda import - fosdem +01 +curl -#L "$url" | agenda import - fosdem +01 diff --git a/bin/update-sfeed b/bin/update-sfeed @@ -1,25 +1,25 @@ #!/bin/sh # update feeds, merge with old feeds. -mkdir -p "${VAR}/sfeed" +mkdir -p "$VAR/sfeed" while read -r name url do - file="${VAR}/sfeed/${name}" + file="$VAR/sfeed/$name" - printf '%-30s %s\n' "${name}" "${url}" - touch "${file}" - mkdir -p "${VAR}/sfeed" \ - "${VAR}/mail/sfeed/${name}/new" \ - "${VAR}/mail/sfeed/${name}/cur" \ - "${VAR}/mail/sfeed/${name}/tmp" + printf '%-30s %s\n' "$name" "$url" + touch "$file" + mkdir -p "$VAR/sfeed" \ + "$VAR/mail/sfeed/$name/new" \ + "$VAR/mail/sfeed/$name/cur" \ + "$VAR/mail/sfeed/$name/tmp" # fetch then sort and merge by id, link, title - curl -#LH 'User-Agent:' "${url}" | + curl -#LH 'User-Agent:' "$url" | sfeed | - sort -t ' ' -u -k6,6 -k3,3 -k2,2 "${file}" - | - sort -t ' ' -k1rn,1 -o "${file}" + sort -t ' ' -u -k6,6 -k3,3 -k2,2 "$file" - | + sort -t ' ' -k1rn,1 -o "$file" # deliver using mblaze(7) - sfeed_mbox "${file}" | mdeliver -M "${VAR}/mail/sfeed/${name}" -done < "${ETC}/sfeed" + sfeed_mbox "$file" | mdeliver -M "$VAR/mail/sfeed/$name" +done < "$ETC/sfeed" diff --git a/bin/wifi b/bin/wifi @@ -1,9 +1,9 @@ #!/bin/sh -[ "${#}" -ne 2 ] && exec printf 'usage: wifi <nwid> <wpa_passphrase>\n' +[ "$#" -ne 2 ] && exec printf 'usage: wifi <nwid> <wpa_passphrase>\n' case "$(uname)" in (*BSD) - doas ifconfig iwm0 nwid "${1}" wpa wpakey "0x${2}" + doas ifconfig iwm0 nwid "$1" wpa wpakey "0x$2" ;; esac diff --git a/bin/xdg-open b/bin/xdg-open @@ -2,15 +2,15 @@ # override the xdg-open utility tty | grep -q -e '^/dev/pts/.*' -e '^/dev/tty.*' || -exec st -f terminus:pixelsize=16 -e "${0}" "${@}" +exec st -f terminus:pixelsize=16 -e "$0" "$@" -[ -e "${1}" ] && set -- "$(cd "$(dirname "${1}")" && pwd)/$(basename "${1}")" -printf '\033]0;%s\a' "${1}" +[ -e "$1" ] && set -- "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" +printf '\033]0;%s\a' "$1" #--- parse uri ----------------------------------------------------------------- # scheme://[user[:pass]@]host[:port][/path] IFS=' ' read scheme user pass host port path << EOF -$(printf %s "${1}" | awk '{ +$(printf %s "$1" | awk '{ gsub(" ", "%20"); gsub("\t", "%0b"); @@ -57,107 +57,107 @@ EOF #--- hierarchical uri ---------------------------------------------------------- -case "${host}" in +case "$host" in (*.onion) - exec torsocks "${0}" "${@}" + exec torsocks "$0" "$@" ;; esac -case "${scheme}" in +case "$scheme" in (9p) - dir="${VAR}/9p/${address}" - mkdir -p "${dir}" - exec doas 9pfs "${address}" "${dir}" + dir="$VAR/9p/$address" + mkdir -p "$dir" + exec doas 9pfs "$address" "$dir" ;; (ftp) - exec ftp "${1}" + exec ftp "$1" ;; (git) - mkdir -p "${HOME}/git/${host}" - cd "${HOME}/git/${host}" || exit 1 - exec git clone "${1}" + mkdir -p "$HOME/git/$host" + cd "$HOME/git/$host" || exit 1 + exec git clone "$1" ;; (gopher) - exec sacc "${1}" + exec sacc "$1" ;; (http|https) - case "${host}" in + case "$host" in (vimeo.com|*youtube.com|*youtu.be|*openload.co*) - mkdir -p "${LIB}/video/${host}" - cd "${LIB}/video/${host}" - youtube-dl "${1}" - exec "${0}" "${LIB}/video/${host}"/*"${1##*[=/]}"* + mkdir -p "$LIB/video/$host" + cd "$LIB/video/$host" + youtube-dl "$1" + exec "$0" "$LIB/video/$host"/*"${1##*[=/]}"* ;; (*bandcamp.com) - mkdir -p "${LIB}/music/${host}" - cd "${LIB}/music/${host}" - exec youtube-dl "${1}" + mkdir -p "$LIB/music/$host" + cd "$LIB/music/$host" + exec youtube-dl "$1" ;; esac - case "${path}" in + case "$path" in (*.torrent) - mkdir -p "${VAR}/torrent" - curl -Lo "${VAR}/torrent/${path##*/}" "${1}" - exec "${0}" "${VAR}/torrent/${path##*/}" + mkdir -p "$VAR/torrent" + curl -Lo "$VAR/torrent/${path##*/}" "$1" + exec "$0" "$VAR/torrent/${path##*/}" ;; (*.jpg|*.JPG|*.jpeg|*.JPEG|*.png|*.PNG|*.gif) - mkdir -p "${LIB}/image/${host}/" - curl -Lo "${LIB}/image/${host}/${path##*/}" "${1}" - exec "${0}" "${LIB}/image/${host}/${path##*/}" + mkdir -p "$LIB/image/$host/" + curl -Lo "$LIB/image/$host/${path##*/}" "$1" + exec "$0" "$LIB/image/$host/${path##*/}" ;; (*.opus|*.ogg|*.mp3|*.flac) - mkdir -p "${LIB}/music/${host}" - curl -Lo "${LIB}/music/${host}/${path##*/}" "${1}" - exec "${0}" "${LIB}/music/${host}/${path##*/}" + mkdir -p "$LIB/music/$host" + curl -Lo "$LIB/music/$host/${path##*/}" "$1" + exec "$0" "$LIB/music/$host/${path##*/}" ;; (*.webm|*.mp4|*.mkv|*.ogv|*.avi) - mkdir -p "${LIB}/video/${host}" - curl -Lo "${LIB}/video/${host}/${path##*/}" "${1}" - exec "${0}" "${LIB}/video/${host}/${path##*/}" + mkdir -p "$LIB/video/$host" + curl -Lo "$LIB/video/$host/${path##*/}" "$1" + exec "$0" "$LIB/video/$host/${path##*/}" ;; (*.pdf|*.ps) - mkdir -p "${LIB}/doc/${host}" - curl -Lo "${LIB}/doc/${host}/${path##*/}" "${1}" - exec "${0}" "${LIB}/doc/${host}/${path##*/}" + mkdir -p "$LIB/doc/$host" + curl -Lo "$LIB/doc/$host/${path##*/}" "$1" + exec "$0" "$LIB/doc/$host/${path##*/}" ;; (*.txt) - mkdir -p "${LIB}/text/${host}" - curl -Lo "${LIB}/text/${host}/${path##*/}" "${1}" - exec "${0}" "${LIB}/text/${host}/${path##*/}" + mkdir -p "$LIB/text/$host" + curl -Lo "$LIB/text/$host/${path##*/}" "$1" + exec "$0" "$LIB/text/$host/${path##*/}" ;; (*.gz|*.bz2|*.xz|*.tgz|*.tgz|*.tbz2|*.txz) - mkdir -p "${HOME}/tmp" - curl -Lo "${HOME}/tmp/${path##*/}" "${1}" - exec "${0}" "${HOME}/tmp/${path##*/}" + mkdir -p "$HOME/tmp" + curl -Lo "$HOME/tmp/${path##*/}" "$1" + exec "$0" "$HOME/tmp/${path##*/}" ;; (*) - exec firefox "${1}" + exec firefox "$1" ;; esac ;; (irc) - [ "${port}" = . ] && port='6667' - "${ETC}/daemon/ii" "${host}" "${port}" - [ "${path}" = . ] && exit + [ "$port" = . ] && port='6667' + "$ETC/daemon/ii" "$host" "$port" + [ "$path" = . ] && exit sleep 3 - printf '/j #%s\n' "${path}" > "${VAR}/irc/${host}/in" + printf '/j #%s\n' "$path" > "$VAR/irc/$host/in" ;; (news) - exec retawq "${1}" + exec retawq "$1" ;; (sftp) address="${1#*://}" address="${address%*:}" - [ "${port}" = . ] && port='22' - exec sftp -P "${port}" "${address}" + [ "$port" = . ] && port='22' + exec sftp -P "$port" "$address" ;; (ssh) address="${1#*://}" address="${address%:*}" - [ "${port}" = . ] && port='22' - exec ssh -p "${port}" "${address}" + [ "$port" = . ] && port='22' + exec ssh -p "$port" "$address" ;; (telnet) address="${1#telnet://}" @@ -167,103 +167,103 @@ esac #--- short uri ----------------------------------------------------------------- -case "${1}" in +case "$1" in (mailto:*) exec mcom "${1#mailto:}" ;; (magnet:*) - exec transmission-cli "${1}" + exec transmission-cli "$1" ;; esac #--- files --------------------------------------------------------------------- -[ -e "${1}" ] && case "${1}" in +[ -e "$1" ] && case "$1" in (*.torrent) - exec transmission-cli "${1}" + exec transmission-cli "$1" ;; (*.img|*.iso) - exec qemu-system-x86_64 -m 500M "${1}" + exec qemu-system-x86_64 -m 500M "$1" ;; #--- media --------------------------------------------------------------------- (*.pdf) - mupdf "${1}" & + mupdf "$1" & exit ;; (*.png|*.PNG) - png2ff < "${1}" | lel & + png2ff < "$1" | lel & exit ;; (*.jpg|*.jpeg|*.JPG|*.JPEG) - jpg2ff < "${1}" | lel & + jpg2ff < "$1" | lel & exit ;; (*.gif) - exec mplayer -loop 0 "${1}" + exec mplayer -loop 0 "$1" ;; (*.webm|*.mp4|*.mkv|*.ogv|*.avi|*.opus|*.mp3|*.flac|*.ogg) - exec ffplay "${1}" + exec ffplay "$1" ;; (*/music/*) - find "${1}" -type f | sort | while IFS='' read -r song + find "$1" -type f | sort | while IFS='' read -r song do - ffplay "${song}" + ffplay "$song" done ;; #--- pager --------------------------------------------------------------------- (*.[0-9]|*.[0-9]p|*.[0-9].gz) - exec mandoc -a "${1}" + exec mandoc -a "$1" ;; (*.o|*.a) - exec radare2 "${1}" + exec radare2 "$1" ;; (*.html) - exec retawq "${1}" + exec retawq "$1" ;; #--- archive ------------------------------------------------------------------- (*.tgz) - mv "${1}" "${1%.tgz}.tar.gz" - exec "${0}" "${1%.tgz}.tar.gz" + mv "$1" "${1%.tgz}.tar.gz" + exec "$0" "${1%.tgz}.tar.gz" ;; (*.tbz) - mv "${1}" "${1%.tbz}.tar.bz2" - exec "${0}" "${1%.tbz}.tar.bz2" + mv "$1" "${1%.tbz}.tar.bz2" + exec "$0" "${1%.tbz}.tar.bz2" ;; (*.txz) - mv "${1}" "${1%.txz}.tar.xz" - exec "${0}" "${1%.txz}.tar.xz" + mv "$1" "${1%.txz}.tar.xz" + exec "$0" "${1%.txz}.tar.xz" ;; (*.bz2) - bzip2 -ds "${1}" - exec "${0}" "${1%.bz2}" + bzip2 -ds "$1" + exec "$0" "${1%.bz2}" ;; (*.gz) - gzip -d "${1}" - exec "${0}" "${1%.gz}" + gzip -d "$1" + exec "$0" "${1%.gz}" ;; (*.xz) - xz -d "${1}" - exec "${0}" "${1%.xz}" + xz -d "$1" + exec "$0" "${1%.xz}" ;; (*.tar) - exec tar -xf "${1}" + exec tar -xf "$1" ;; (*.rar) - exec unrar x "${1}" + exec unrar x "$1" ;; (*.zip) - exec unzip "${1}" + exec unzip "$1" ;; (*.Z) - exec uncompress "${1}" + exec uncompress "$1" ;; (*.7z) - exec 7z x "${1}" + exec 7z x "$1" ;; (*.deb) - exec ar vx "${1}" + exec ar vx "$1" ;; esac -[ -d "${1}" ] && exec io grep "${1}" -[ -f "${1}" ] && exec ${EDITOR} "${1}" +[ -d "$1" ] && exec io grep "$1" +[ -f "$1" ] && exec $EDITOR "$1" diff --git a/pack/b2sum/build b/pack/b2sum/build @@ -3,4 +3,4 @@ cd b2sum make NO_OPENMP='1' -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/busybox/build b/pack/busybox/build @@ -1,3 +1,3 @@ #!/bin/sh -e -case "${uname}" in (Linux) make='make' ;; (*BSD) make='gmake' ;; esac +case "$uname" in (Linux) make='make' ;; (*BSD) make='gmake' ;; esac diff --git a/pack/cgo/build b/pack/cgo/build @@ -1,7 +1,7 @@ #!/bin/sh -e make -make PREFIX="${OPT}" install +make PREFIX="$OPT" install -mkdir -p "${OPT}/share/man/man1" -cp cgo.1 "${OPT}/share/man/man1" +mkdir -p "$OPT/share/man/man1" +cp cgo.1 "$OPT/share/man/man1" diff --git a/pack/collectd/build b/pack/collectd/build @@ -1,12 +1,12 @@ #!/bin/sh -e -! patch -Nup1 < "${PKG}/OpenBSD.patch" +! patch -Nup1 < "$PKG/OpenBSD.patch" ./configure \ - --prefix="${OPT}" \ - --sbindir="${OPT}/bin" \ - --localstatedir="${VAR}" \ - --sysconfdir="${ETC}" \ + --prefix="$OPT" \ + --sbindir="$OPT/bin" \ + --localstatedir="$VAR" \ + --sysconfdir="$ETC" \ --disable-perl \ --disable-python \ --disable-lua \ diff --git a/pack/dash/build b/pack/dash/build @@ -1,7 +1,7 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" + --prefix="$OPT" case "$(uname)" in (*BSD) make='gmake' ;; (*) make='make' ;; esac diff --git a/pack/dwm/build b/pack/dwm/build @@ -1,6 +1,6 @@ #!/bin/sh -e -cp -f "${PKG}"/*.h "${SRC}" -cp -f "${PKG}/config.mk" "${SRC}/config.mk" +cp -f "$PKG"/*.h "$SRC" +cp -f "$PKG/config.mk" "$SRC/config.mk" -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/ed/build b/pack/ed/build @@ -1,5 +1,5 @@ #!/bin/sh -e -mkdir -p "${OPT}/bin" +mkdir -p "$OPT/bin" -cc -o "${OPT}/bin/ed" ed.c +cc -o "$OPT/bin/ed" ed.c diff --git a/pack/enchive/build b/pack/enchive/build @@ -2,5 +2,5 @@ make -mkdir -p "${OPT}/bin" +mkdir -p "$OPT/bin" cp enchive "${OPT]/bin" diff --git a/pack/entr/build b/pack/entr/build @@ -2,4 +2,4 @@ ./configure -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/farbfeld-resize/build b/pack/farbfeld-resize/build @@ -2,5 +2,5 @@ make -mkdir -p "${OPT}/bin" -cp resize "${OPT}/bin/resize" +mkdir -p "$OPT/bin" +cp resize "$OPT/bin/resize" diff --git a/pack/farbfeld/build b/pack/farbfeld/build @@ -2,4 +2,4 @@ case "$(uname)" in (*BSD) make='gmake' ;; (*) make='make' ;; esac -$make PREFIX="${OPT}" install +$make PREFIX="$OPT" install diff --git a/pack/ffmpeg/build b/pack/ffmpeg/build @@ -1,6 +1,6 @@ #!/bin/sh -e -./configure --prefix="${OPT}" +./configure --prefix="$OPT" case $(uname) in (*BSD) make="gmake" ;; (*) make='make' ;; esac diff --git a/pack/git/build b/pack/git/build @@ -1,7 +1,7 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" \ + --prefix="$OPT" \ --without-tcltk case "$(uname)" in (*BSD) make='gmake' ;; (*) make='make' ;; esac diff --git a/pack/liblz4/build b/pack/liblz4/build @@ -2,4 +2,4 @@ case "$(uname)" in (*BSD) make='gmake' ;; (*) make='make' ;; esac -$make PREFIX="${OPT}" install +$make PREFIX="$OPT" install diff --git a/pack/libmusl/build b/pack/libmusl/build @@ -1,14 +1,14 @@ #!/bin/sh set -e -export LDFLAGS="${LDFLAGS} -Wl,-rpath-link=$SYSROOT$OPT/lib" -export CC="$CC -L${SYS}/lib -isystem ${SYS}/include" +export LDFLAGS="$LDFLAGS -Wl,-rpath-link=$SYSROOT$OPT/lib" +export CC="$CC -L$SYS/lib -isystem $SYS/include" -[ -n "${CROSS_COMPILE}" ] && CONFFLAGS="${CONFFLAGS} --host=${CROSS_COMPILE}" +[ -n "$CROSS_COMPILE" ] && CONFFLAGS="$CONFFLAGS --host=$CROSS_COMPILE" ./configure \ - --prefix="${OPT}" \ - --syslibdir="${OPT}"/lib + --prefix="$OPT" \ + --syslibdir="$OPT"/lib make -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/libopus/build b/pack/libopus/build @@ -1,6 +1,7 @@ #!/bin/sh -e -./configure --prefix="${OPT}" +./configure \ + --prefix="$OPT" case "$(uname)" in (*BSD) make='gmake' ;; (*) make=make ;; esac diff --git a/pack/libtox/build b/pack/libtox/build @@ -1,13 +1,13 @@ #!/bin/sh -e -export OPUS_CFLAGS="-I${SYS}/include/opus" -export OPUS_LIBS="-L${SYS}/lib" -export VPX_CFLAGS="-I${SYS}/include" -export VPX_LIBS="-L${SYS}/lib" -export CFLAGS="-I${SYS}/include/opus" +export OPUS_CFLAGS="-I$SYS/include/opus" +export OPUS_LIBS="-L$SYS/lib" +export VPX_CFLAGS="-I$SYS/include" +export VPX_LIBS="-L$SYS/lib" +export CFLAGS="-I$SYS/include/opus" ./configure \ --prefix="$OPT" \ - --with-dependency-search="${SYS}" + --with-dependency-search="$SYS" make install diff --git a/pack/man-c++/build b/pack/man-c++/build @@ -1,5 +1,5 @@ #!/bin/sh -e -mkdir -p "${OPT}/share/man" +mkdir -p "$OPT/share/man" -cp -r man3 "${OPT}/share/man/man3" +cp -r man3 "$OPT/share/man/man3" diff --git a/pack/man-posix/build b/pack/man-posix/build @@ -1,3 +1,3 @@ #!/bin/sh -e -make prefix="${OPT}" install +make prefix="$OPT" install diff --git a/pack/mblaze/build b/pack/mblaze/build @@ -2,4 +2,4 @@ case "$(uname)" in (*BSD) make='gmake' ;; (Linux) make='make' ;; esac -$make PREFIX="${OPT}" install +$make PREFIX="$OPT" install diff --git a/pack/minilisp/build b/pack/minilisp/build @@ -2,6 +2,6 @@ make -mkdir -p "${OPT}/bin" +mkdir -p "$OPT/bin" -cp minilisp "${OPT}/bin" +cp minilisp "$OPT/bin" diff --git a/pack/mpop/build b/pack/mpop/build @@ -1,14 +1,14 @@ #!/bin/sh -e -export libssl_CFLAGS="-I${SYS}/include" -export libssl_LIBS="-L${SYS}/lib -lssa -lcrypto" +export libssl_CFLAGS="-I$SYS/include" +export libssl_LIBS="-L$SYS/lib -lssa -lcrypto" ./configure \ - --prefix="${OPT}" \ + --prefix="$OPT" \ --with-tls='openssl' make \ CFLAGS="$libssl_CFLAGS" \ - LDFLAGS="-L${SYS}/lib -lssl -lcrypto" \ + LDFLAGS="-L$SYS/lib -lssl -lcrypto" \ -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/msmtp/build b/pack/msmtp/build @@ -1,14 +1,14 @@ #!/bin/sh -e -export libssl_CFLAGS="-I${SYS}/include" -export libssl_LIBS="-L${SYS}/lib -lssl -lcrypto" +export libssl_CFLAGS="-I$SYS/include" +export libssl_LIBS="-L$SYS/lib -lssl -lcrypto" ./configure \ - --prefix="${OPT}" \ + --prefix="$OPT" \ --with-tls=openssl make -make PREFIX="${OPT}" install +make PREFIX="$OPT" install -ln -s "${OPT}/bin/msmtp" "${OPT}/bin/sendmail" +ln -s "$OPT/bin/msmtp" "$OPT/bin/sendmail" diff --git a/pack/mupdf/build b/pack/mupdf/build @@ -2,4 +2,4 @@ case "$(uname)" in (*BSD) make='gmake' ;; (*) make='make' ;; esac -$make prefix="${OPT}" install +$make prefix="$OPT" install diff --git a/pack/ngircd/build b/pack/ngircd/build @@ -1,9 +1,9 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" \ - --sysconfdir="${ETC}" \ - --sbindir="${OPT}/bin" + --prefix="$OPT" \ + --sysconfdir="$ETC" \ + --sbindir="$OPT/bin" --with-openssl make install diff --git a/pack/openssh/build b/pack/openssh/build @@ -1,8 +1,8 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" \ - --sbindir="${OPT}/bin" + --prefix="$OPT" \ + --sbindir="$OPT/bin" make install diff --git a/pack/opentracker/build b/pack/opentracker/build @@ -1,7 +1,7 @@ #!/bin/sh -e make \ - LIBOWFAT_HEADERS="${SYS}/include" \ - LIBOWFAT_LIBRARY="${SYS}/lib" + LIBOWFAT_HEADERS="$SYS/include" \ + LIBOWFAT_LIBRARY="$SYS/lib" -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/radare2/build b/pack/radare2/build @@ -1,7 +1,7 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" + --prefix="$OPT" case "$(uname)" (*BSD) make='gmake' ;; (*) make='make' ;; esac diff --git a/pack/reflex/build b/pack/reflex/build @@ -1,8 +1,8 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" + --prefix="$OPT" make install -ln -s "${OPT}/bin/reflex" "${OPT}/bin/flex" +ln -s "$OPT/bin/reflex" "$OPT/bin/flex" diff --git a/pack/retawq/build b/pack/retawq/build @@ -1,11 +1,11 @@ #!/bin/sh -e -patch -p1 < "${PKG}/resource.c.patch" +patch -p1 < "$PKG/resource.c.patch" ./configure \ --set-tls=2 \ - --program-prefix="${OPT}" \ - --path-prefix="${OPT}" + --program-prefix="$OPT" \ + --path-prefix="$OPT" make diff --git a/pack/rsync/build b/pack/rsync/build @@ -1,6 +1,6 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" + --prefix="$OPT" make install diff --git a/pack/runit/build b/pack/runit/build @@ -8,7 +8,7 @@ fi package/compile -mkdir -p "${OPT}/share/man/man8" -cp man/* "${OPT}/share/man/man8" -mkdir -p "${OPT}/bin" -cp command/* "${OPT}/bin" +mkdir -p "$OPT/share/man/man8" +cp man/* "$OPT/share/man/man8" +mkdir -p "$OPT/bin" +cp command/* "$OPT/bin" diff --git a/pack/sfeed/build b/pack/sfeed/build @@ -1,6 +1,6 @@ #!/bin/sh -e -cp "${PKG}/sfeed_twtxt.c" "${SRC}" -make MANPREFIX="${OPT}/share/man" PREFIX="${OPT}" install +cp "$PKG/sfeed_twtxt.c" "$SRC" +make MANPREFIX="$OPT/share/man" PREFIX="$OPT" install make BIN='sfeed_twtxt' -cp "${SRC}/sfeed_twtxt" "${OPT}/bin/sfeed_twtxt" +cp "$SRC/sfeed_twtxt" "$OPT/bin/sfeed_twtxt" diff --git a/pack/st/build b/pack/st/build @@ -2,8 +2,8 @@ THEME='helios_dark' -cp "${PKG}/config.h" config.h -cp "${PKG}/config.mk" config.mk -cp "${PKG}/$THEME.h" colors.h +cp "$PKG/config.h" config.h +cp "$PKG/config.mk" config.mk +cp "$PKG/$THEME.h" colors.h -make PREFIX="${OPT}" install +make PREFIX="$OPT" install diff --git a/pack/sup/build b/pack/sup/build @@ -3,4 +3,4 @@ case $(uname) in (*BSD) make=gmake ;; (*) make=make ;; esac $make -$make PREFIX="${OPT}" install +$make PREFIX="$OPT" install diff --git a/pack/tcpdump/build b/pack/tcpdump/build @@ -1,7 +1,7 @@ #!/bin/sh ./configure \ - --prefix="${OPT}" \ - --sbindir="${OPT}/bin" + --prefix="$OPT" \ + --sbindir="$OPT/bin" make install diff --git a/pack/tinc/build b/pack/tinc/build @@ -3,10 +3,10 @@ case "$(uname)" in (*BSD) make=gmake ;; (*) make=make ;; esac ./configure \ - --prefix="${OPT}" \ - --sbindir="${OPT}/bin" \ - --sysconfdir="${HOME}/.config" \ - --localstatedir="${HOME}/.cache" \ + --prefix="$OPT" \ + --sbindir="$OPT/bin" \ + --sysconfdir="$HOME/.config" \ + --localstatedir="$HOME/.cache" \ --disable-lzo \ --disable-readline \ --disable-curses diff --git a/pack/u9fs/build b/pack/u9fs/build @@ -1,4 +1,4 @@ #!/bin/sh -e -mkdir -p "${OPT}/bin" +mkdir -p "$OPT/bin" make DESTROOT="${OPT{" install diff --git a/pack/xinetd/build b/pack/xinetd/build @@ -1,8 +1,8 @@ #!/bin/sh -e ./configure \ - --prefix="${OPT}" \ - --sbindir="${OPT}/bin" \ - --mandir="${OPT}/share/man" + --prefix="$OPT" \ + --sbindir="$OPT/bin" \ + --mandir="$OPT/share/man" make install diff --git a/run/collectd b/run/collectd @@ -2,7 +2,7 @@ exec collectd \ -f \ - -P "${RUN}/collectd.pid" \ - -C "${ETC}/collectd.conf" \ - 1>> "${LOG}/collectd" \ - 2>> "${LOG}/collectd" & + -P "$RUN/collectd.pid" \ + -C "$ETC/collectd.conf" \ + 1>> "$LOG/collectd" \ + 2>> "$LOG/collectd" & diff --git a/run/crond b/run/crond @@ -2,5 +2,5 @@ exec crond \ -f "/etc/crontab" \ - 1>> "${LOG}/crond" \ - 2>> "${LOG}/crond" & + 1>> "$LOG/crond" \ + 2>> "$LOG/crond" & diff --git a/run/geomyidae b/run/geomyidae @@ -1,12 +1,12 @@ #!/bin/sh -e -path="${1:-${HOME}/srv}" +path="${1:-$HOME/srv}" port="${2:-70}" host="${3:-josuah.net}" exec geomyidae \ - -b "${path}" \ - -p "${port}" \ - -h "${host}" \ - 1>> "${LOG}/geomyidae" \ - 2>> "${LOG}/geomyidae" & + -b "$path" \ + -p "$port" \ + -h "$host" \ + 1>> "$LOG/geomyidae" \ + 2>> "$LOG/geomyidae" & diff --git a/run/git b/run/git @@ -1,11 +1,11 @@ #!/bin/sh -e -path="${1:-${HOME}/srv/git}" +path="${1:-$HOME/srv/git}" port="${2:-9000}" exec git daemon \ - --base-path="${path}" \ + --base-path="$path" \ --export-all \ - --port="${port}" \ - 1>> "${LOG}/git" \ - 2>> "${LOG}/git" & + --port="$port" \ + 1>> "$LOG/git" \ + 2>> "$LOG/git" & diff --git a/run/ii b/run/ii @@ -3,14 +3,14 @@ host="${1:?host required}" port="${2:-6667}" -mkdir -p "${VAR}/irc/${host}" "${LOG}/ii" +mkdir -p "$VAR/irc/$host" "$LOG/ii" -pgrep -f "ii -s ${host}" || exec ii \ - -s "${host}" \ - -i "${VAR}/irc" \ - -p "${port}" \ - -n "${NICK}ii" \ +pgrep -f "ii -s $host" || exec ii \ + -s "$host" \ + -i "$VAR/irc" \ + -p "$port" \ + -n "$NICKii" \ -k "PASS" \ - -f "${NAME}" \ - 1>> "${VAR}/irc/${host}/log" \ - 2>> "${LOG}/ii/${host}" & + -f "$NAME" \ + 1>> "$VAR/irc/$host/log" \ + 2>> "$LOG/ii/$host" & diff --git a/run/inetd b/run/inetd @@ -1,5 +1,5 @@ #!/bin/sh -e exec inetd \ - 1>> "${LOG}/inetd" \ - 2>> "${LOG}/inetd" & + 1>> "$LOG/inetd" \ + 2>> "$LOG/inetd" & diff --git a/run/irc.cyberia.is b/run/irc.cyberia.is @@ -2,14 +2,14 @@ host='irc.cyberia.is' -mkdir -p "${VAR}/irc/${host}" "${LOG}/ii" +mkdir -p "$VAR/irc/$host" "$LOG/ii" -pgrep -f "ii -s ${host}" || exec ii \ - -s "${host}" \ - -i "${VAR}/irc" \ - -u "/tmp/${host}" \ - -n "${NICK}ii" \ +pgrep -f "ii -s $host" || exec ii \ + -s "$host" \ + -i "$VAR/irc" \ + -u "/tmp/$host" \ + -n "$NICKii" \ -k "PASS" \ - -f "${NAME}" \ - 1>> "${VAR}/irc/${host}/log" \ - 2>> "${LOG}/ii/${host}" & + -f "$NAME" \ + 1>> "$VAR/irc/$host/log" \ + 2>> "$LOG/ii/$host" & diff --git a/run/irc.freenode.net b/run/irc.freenode.net @@ -2,14 +2,14 @@ host='irc.freenode.net' -mkdir -p "${VAR}/irc/${host}" "${LOG}/ii" +mkdir -p "$VAR/irc/$host" "$LOG/ii" -pgrep -f "ii -s ${host}" || exec ii \ - -s "${host}" \ - -i "${VAR}/irc" \ - -u "/tmp/${host}" \ - -n "${NICK}ii" \ +pgrep -f "ii -s $host" || exec ii \ + -s "$host" \ + -i "$VAR/irc" \ + -u "/tmp/$host" \ + -n "$NICKii" \ -k "PASS" \ - -f "${NAME}" \ - 1>> "${VAR}/irc/${host}/log" \ - 2>> "${LOG}/ii/${host}" & + -f "$NAME" \ + 1>> "$VAR/irc/$host/log" \ + 2>> "$LOG/ii/$host" & diff --git a/run/irc.oftc.net b/run/irc.oftc.net @@ -2,14 +2,14 @@ host='irc.oftc.net' -mkdir -p "${VAR}/irc/${host}" "${LOG}/ii" +mkdir -p "$VAR/irc/$host" "$LOG/ii" -pgrep -f "ii -s ${host}" || exec ii \ - -s "${host}" \ - -i "${VAR}/irc" \ - -u "/tmp/${host}" \ - -n "${NICK}ii" \ +pgrep -f "ii -s $host" || exec ii \ + -s "$host" \ + -i "$VAR/irc" \ + -u "/tmp/$host" \ + -n "$NICKii" \ -k "PASS" \ - -f "${NAME}" \ - 1>> "${VAR}/irc/${host}/log" \ - 2>> "${LOG}/ii/${host}" & + -f "$NAME" \ + 1>> "$VAR/irc/$host/log" \ + 2>> "$LOG/ii/$host" & diff --git a/run/ngircd b/run/ngircd @@ -3,5 +3,5 @@ exec ngircd \ -n \ -f "/etc/ngircd/conf" \ - 1>> "${LOG}/ngircd" \ - 2>> "${LOG}/ngircd" & + 1>> "$LOG/ngircd" \ + 2>> "$LOG/ngircd" & diff --git a/run/opentracker b/run/opentracker @@ -1,6 +1,6 @@ #!/bin/sh -e exec opentracker \ - -d "${VAR}/torrent" \ - 1>> "${LOG}/opentracker" \ - 2>> "${LOG}/opentracker" & + -d "$VAR/torrent" \ + 1>> "$LOG/opentracker" \ + 2>> "$LOG/opentracker" & diff --git a/run/quark b/run/quark @@ -1,10 +1,10 @@ #!/bin/sh -e -path="${1:-${HOME}/srv}" +path="${1:-$HOME/srv}" exec quark \ -h localhost \ - -d "${path}" \ + -d "$path" \ -V \ - 1>> "${LOG}/quark" \ - 2>> "${LOG}/quark" & + 1>> "$LOG/quark" \ + 2>> "$LOG/quark" & diff --git a/run/ratox b/run/ratox @@ -1,10 +1,10 @@ #!/bin/sh -e -path="${1:-${VAR}/ratox}" +path="${1:-$VAR/ratox}" -mkdir -p "${path}" -cd "${path}" +mkdir -p "$path" +cd "$path" exec ratox \ - 1>> "${LOG}/ratox" \ - 2>> "${LOG}/ratox" & + 1>> "$LOG/ratox" \ + 2>> "$LOG/ratox" & diff --git a/run/ssh-agent b/run/ssh-agent @@ -1,9 +1,9 @@ #!/bin/sh -e mkdir -p "${SSH_AUTH_SOCK%/*}" -rm -f "${SSH_AUTH_SOCK}" +rm -f "$SSH_AUTH_SOCK" ssh-agent \ - -a "${SSH_AUTH_SOCK}" \ - 1>> "${LOG}/ssh-agent" \ - 2>> "${LOG}/ssh-agent" & + -a "$SSH_AUTH_SOCK" \ + 1>> "$LOG/ssh-agent" \ + 2>> "$LOG/ssh-agent" & diff --git a/run/tincd b/run/tincd @@ -1,6 +1,6 @@ #!/bin/sh -e -mkdir -p "${RUN}" +mkdir -p "$RUN" exec tincd \ - --logfile="${LOG}/tincd" + --logfile="$LOG/tincd" diff --git a/run/tor b/run/tor @@ -1,5 +1,5 @@ #!/bin/sh -e exec tor \ - 1>> "${LOG}/tor" \ - 2>> "${LOG}/tor" & + 1>> "$LOG/tor" \ + 2>> "$LOG/tor" & diff --git a/run/unix.chat b/run/unix.chat @@ -2,14 +2,14 @@ host='unix.chat' -mkdir -p "${VAR}/irc/${host}" "${LOG}/ii" +mkdir -p "$VAR/irc/$host" "$LOG/ii" -pgrep -f "ii -s ${host}" || exec ii \ - -s "${host}" \ - -i "${VAR}/irc" \ - -u "/tmp/${host}" \ - -n "${NICK}ii" \ +pgrep -f "ii -s $host" || exec ii \ + -s "$host" \ + -i "$VAR/irc" \ + -u "/tmp/$host" \ + -n "$NICKii" \ -k "PASS" \ - -f "${NAME}" \ - 1>> "${VAR}/irc/${host}/log" \ - 2>> "${LOG}/ii/${host}" & + -f "$NAME" \ + 1>> "$VAR/irc/$host/log" \ + 2>> "$LOG/ii/$host" &