# note: i store a log of emacs versions i've used in /a/opt/emacs/iank-readme
-if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
+source /b/distro-functions/src/identify-distros
+source /b/distro-functions/src/package-manager-abstractions
+source /b/log-quiet/logq-function
+m() { printf "%s\n" "$*"; "$@"; }
#set -x
# arg = git commit to check out
sudo apt-get -y install --purge --auto-remove apt-rdepends
fi
codename=$(debian-codename)
- if [[ $x == emacs && codename == aramo ]]; then
+ if [[ $x == emacs && $codename == aramo ]]; then
codename=bookworm
fi
if ! apt-cache show emacs/$codename &>/dev/null; then
if [[ -e $dir ]]; then
m cd $dir
rev=$(cat $last_build 2>/dev/null) ||:
- head=$(git rev-parse HEAD)
+ if [[ -e .git/iank-head ]]; then
+ head=$(cat .git/iank-head)
+ fi
if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
echo "already compiled"
if emacs_path=$(type -P emacs 2>/dev/null); then
- installed_info=$(file -b $(readlink -f $emacs_path))
+ installed_info=$(file -bL $emacs_path)
build_info=$(file -b $dir/src/emacs)
if [[ $installed_info == "$build_info" ]]; then
echo "already installed exiting"
if $bootstrap; then
m rsync --exclude /.git --delete-excluded -ra /a/opt/emacs/ $dir
- mkdir $dir.git
- m rsync -ra /a/opt/emacs/.git/{HEAD,refs} $dir/.git
+ mkdir $dir/.git
+ printf "%s\n" "$head" >$dir/.git/iank-head
recompile=true
fi
;;&
debian|ubuntu|trisquel)
# todo: unknown for other distros, this will fail
- logq p -y build-dep maildir-utils/$(debian-archive)
+ logq p -y build-dep maildir-utils/"$(debian-archive)"
if [[ $(debian-codename) == aramo ]]; then
# we need newer build deps
logq p -y build-dep emacs/bookworm
else
logq ./configure
fi
- logq make -j `nproc` bootstrap
- logq make -j `nproc`
+ nproc=$(nproc)
+ logq make -j $nproc bootstrap
+ logq make -j $nproc
if ! $nox; then
logq sudo make install
# make emacs always work for root
-f) force=true ;;
esac
+pre=buildscripts/go
m() { printf "$pre %s\n" "$*"; "$@"; }
e() { printf "$pre %s\n" "$*"; }
err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; }
mkdir -p ~/.local
touch ~/.local/gofetch
- vers=($(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head))
+ tmpf=$(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head)
+ maptfile -t vers <<<"$tmpf"
+ # shellcheck disable=SC2154 # false positive
ver=${vers[0]}
dl() {
arch=$(dpkg --print-architecture)
fi
new_timestamp=$(stat -c %Y $f)
- if [[ $timestamp != $new_timestamp ]]; then
+ if [[ $timestamp != "$new_timestamp" ]]; then
install=true
fi
fi
fi
for x in go*.tar.gz; do
- if [[ $x == $f ]]; then continue; fi
+ if [[ $x == "$f" ]]; then continue; fi
rm -fv $x
done
# limitations under the License.
-if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
+source /b/distro-functions/src/identify-distros
+source /b/distro-functions/src/package-manager-abstractions
+source /b/log-quiet/logq-function
+m() { printf "%s\n" "$*"; "$@"; }
cd /a/opt/mu
if [[ -e $dir ]]; then
m cd $dir
rev=$(cat $last_build 2>/dev/null) ||:
- head=$(git rev-parse HEAD)
+ if [[ -e .git/iank-head ]]; then
+ head=$(cat .git/iank-head)
+ fi
if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
echo "already compiled"
if mu_path=$(type -P mu 2>/dev/null); then
- installed_info=$(file -b $(readlink -f $mu_path))
+ installed_info=$(file -bL "$mu_path")
build_info=$(file -b $dir/build/mu/mu)
if [[ $installed_info == "$build_info" ]]; then
echo "already installed exiting"
fi
if $bootstrap; then
- m rsync --delete -ra /a/opt/mu/ $dir
+ m rsync --exclude /.git --delete-excluded -ra /a/opt/mu/ $dir
+ mkdir $dir/.git
+ printf "%s\n" "$head" >$dir/.git/iank-head
recompile=true
cd $dir
fi
fi
if $recompile; then
m git clean -xfffd
- m ./autogen.sh && make -j`nproc`
+ nproc=$(nproc)
+ m ./autogen.sh && make -j$nproc
# note uninstall is implemented
m sudo make install
else
up=$(wget -q -O- https://api.github.com/repos/navidrome/navidrome/releases/latest | jq -r .assets[].browser_download_url | grep Linux_x86_64)
re='[[:space:]]'
-if [[ ! $up || $up == $re ]]; then
+if [[ ! $up || $up == "$re" ]]; then
echo "failed to get good update url. got: $up"
fi
uptar=${up##*/}
# limitations under the License.
-if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi
+set -e; . /usr/local/lib/bash-bear; set +e
# stable version is shown on:
echo "$0: error: failed to curl tor directory listing" >&2
exit 1
fi
-vers=($(printf "%s\n" "$c" | sed -rn 's#.*href="([0-9]+\.[0-9]+[.0-9]*)/.*#\1#p' | sort -Vr))
+tmpf=$(printf "%s\n" "$c" | sed -rn 's#.*href="([0-9]+\.[0-9]+[.0-9]*)/.*#\1#p' | sort -Vr)
+mapfile -t vers <<<"$tmpf"
# by default it has perms for just 1 non-root user, which is ok for now.
done
new_timestamp=$(stat -c %Y $f)
-if [[ $timestamp != $new_timestamp || ! -e /a/opt/tor-browser/Browser/start-tor-browser ]]; then
+if [[ $timestamp != "$new_timestamp" || ! -e /a/opt/tor-browser/Browser/start-tor-browser ]]; then
# not already installed
rm -rf tor-browser
tar Jxf $f
for x in tor-*.tar.xz; do
# cleanup old tarballs
[[ -e $x ]] || break
- [[ $x != $f ]] || continue
+ [[ $x != "$f" ]] || continue
command rm -f $x
done