-Build and install misc software
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+The following is the GNU All-permissive License as recommended in
+<https://www.gnu.org/licenses/license-recommendations.en.html>
+
+Copyright (C) 2024 Ian Kelling <ian@iankelling.org>
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without any warranty.
+
+Ian's scripts to build and install misc software
+
+Most of these are not in use and may have bitrotted, grep -r my
+distro-setup repo for the ones that are.
Please email me if you have a patches, bugs, feedback, or republish this
somewhere else: Ian Kelling <ian@iankelling.org>.
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: GPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
-source /a/bin/errhandle/err
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+source /a/bin/bash-bear-trap/bash-bear
source /a/bin/distro-functions/src/package-manager-abstractions
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# misc interesting:
# https://github.com/sergeyksv/tingodb
--- /dev/null
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# initial setup:
+# as root
+cp -ra /var/lib/debbugs /o
+debbugsconfig
#!/bin/bash
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+
if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
if [[ $1 == -u ]]; then
#!/bin/bash
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+
if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
#set -x
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# one off for ted to get a newer emacs
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# libgcrypt-dev is a test dependency
# libidn11-dev is some build dep for newer version not in
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: AGPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# usage: no args, run to install latest go.
if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-source /a/bin/errhandle/err
+source /usr/local/lib/bash-bear
force=false
case $1 in
err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; }
+if [[ ! -d /a/opt/go.git ]]; then
+ mkdir -p /a/opt
+ cd /a/opt
+ git clone --bare https://go.googlesource.com/go
+fi
m cd /a/opt/go.git
if $up; then
m git fetch --tags
+ mkdir -p ~/.local
touch ~/.local/gofetch
vers=($(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head))
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
-source /a/bin/errhandle/err
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+source /a/bin/bash-bear-trap/bash-bear
if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi
#!/bin/bash
-# Copyright (C) 2020 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+
if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
pi libgirepository1.0-dev python3-dev
#!/bin/bash
-f=/usr/local/lib/err;test -r $f || { echo "error: $0 no $f" >&2;exit 1;}; . $f
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e; . /usr/local/lib/bash-bear; set +e
+
+# I can't remember why I built this from source.
+# It exists in the repo. Oh well.
cd /a/opt/mblaze
make
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: AGPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-# alternatively, using https://iankelling.org/git/?p=errhandle;a=tree
-# source /path/errhandle/err
-# on my machine
-source /a/bin/errhandle/err
+source /a/bin/bash-bear-trap/bash-bear
# fuck pip. i hate it.
# pip install --user -U pip
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: AGPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# example https://github.com/navidrome/navidrome/releases/download/v0.48.0/navidrome_0.48.0_Linux_x86_64.tar.gz
up=$(wget -q -O- https://api.github.com/repos/navidrome/navidrome/releases/latest | jq -r .assets[].browser_download_url | grep Linux_x86_64)
#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
#https://github.com/nodesource/distributions/blob/master/README.md
KEYRING=/usr/share/keyrings/nodesource.gpg
#!/bin/bash
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+
# git clone git://orgmode.org/org-mode.git
# texinfo is all that is technically needed, but having tex for math is good
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: AGPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
+++ /dev/null
-#!/bin/bash
-
-if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
-shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
-
-[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
-
-
-usage() {
- cat <<EOF
-Usage: ${0##*/} [-d]
-Install prometheus-node-exporter for debian based system with sysv or systemd
-
--d Skip downloading and installing the latest binary
--s Skip setup: config files, user, init scripts.
--l Listen only on local interface.
--h|--help Print help and exit.
-
-For downloading, requires curl wget and jq
-
-EOF
- exit $1
-}
-
-##### begin command line parsing ########
-
-
-# defaults
-dl_bin=true
-do_setup=true
-listen_address=0.0.0.0
-
-while [[ $1 ]]; do
- case $1 in
- -d) dl_bin=false ;;
- -s) do_setup=false ;;
- -l) listen_address=127.0.0.1 ;;
- -h|--help) usage 0 ;;
- esac
- shift
-done
-readonly dl_bin do_setup
-
-##### end command line parsing ########
-
-if $dl_bin; then
- for p in curl wget jq; do
- if ! type -t $p &>/dev/null; then
- apt-get -y install $p
- fi
- done
-fi
-if $do_setup && ! type -t rsync &>/dev/null; then
- # note: we could use diff or cmp instead.
- apt-get -y install rsync
-fi
-
-sysd_reload=false
-installed_file=false
-
-i() { # install file
- local tmp tmpdir dest="$1"
- local base="${dest##*/}"
- local dir="${dest%/*}"
- if [[ $dir != "$base" ]]; then
- # dest has a directory component
- mkdir -p "$dir"
- fi
- tmpdir=$(mktemp -d)
- cat >$tmpdir/"$base"
- tmp=$(rsync -ic $tmpdir/"$base" "$dest")
- if [[ $tmp ]]; then
- printf "%s\n" "$tmp"
- installed_file=true
- if [[ $dest == /etc/systemd/system/* ]]; then
- sysd_reload=true
- fi
- fi
- rm -rf $tmpdir
-}
-
-
-if $dl_bin; then
- if [[ -s /usr/local/src/node-exporter-url ]]; then
- installed_url=$(cat /usr/local/src/node-exporter-url)
- fi
- url=$(curl -s https://api.github.com/repos/prometheus/node_exporter/releases/latest | jq -r '.assets[].browser_download_url | match(".*linux-amd64.tar.gz$").string')
- if [[ ! $url ]]; then
- echo $0: error failed to get url
- exit 1
- fi
- if [[ $url != "$installed_url" ]]; then
- tmpdir=$(mktemp -d)
- cd $tmpdir
- f=${url##*/}
- wget -nv $url
- tar -xf $f
- dir=${f%.tar.gz}
- install $dir/node_exporter /usr/local/bin/prometheus-node-exporter
- printf "%s\n" "$url" >/usr/local/src/node-exporter-url
- cd
- rm -rf $tmpdir
- fi
-fi
-
-if ! $do_setup; then
- exit 0
-fi
-
-# taken from postinstall script
-if ! getent passwd prometheus &>/dev/null; then
- adduser --quiet --system --home /var/lib/prometheus --no-create-home \
- --group --gecos "Prometheus daemon" prometheus
-fi
-
-
-# textfile collector dir
-mkdir -p /var/lib/prometheus/node-exporter
-
-chown prometheus:prometheus /var/lib/prometheus
-
-
-i /etc/default/prometheus-node-exporter <<EOF
-# Set the command-line arguments to pass to the server.
-# Due to shell scaping, to pass backslashes for regexes, you need to double
-# them (\\d for \d). If running under systemd, you need to double them again
-# (\\\\d to mean \d), and escape newlines too.
-
-# sometime before 1.5 systemd was a default collector
-ARGS="--web.listen-address=${listen_address}:9100 --collector.textfile.directory=/var/lib/prometheus/node-exporter --collector.systemd"
-# to see all possible args, run with --help
-EOF
-
-if [[ -d /etc/systemd/system ]]; then # we are using systemd
-
- # this is just fixing a screwed up state we shouldnt get into normally.
- if [[ -e /etc/init.d/prometheus-node-exporter ]]; then
- sysd_reload=true
- rm -f /etc/init.d/prometheus-node-exporter
- fi
-
-
- # I used to have logic to handle having the distro package installed, which would then just override it's service file in some ways. The only differences of the
- # packaged version in t11 is that it creates /var/log/prometheus and a
- # logrotate, but nothing is logged there. And it depends on
- # prometheus-node-exporter-collectors, which is useful, but
- # depends on prometheus-node-exporter. We would have no
- # reason to install prometheus-node-exporter except that
- # dependency. But since the collectors package is just a few
- # small scripts we don't even currently use, and of course are not
- # there on old versions, lets not try to use that package, and
- # just manually install the files we want from upstream.
- # https://github.com/prometheus-community/node-exporter-textfile-collector-scripts
-
- if [[ -e /lib/systemd/system/prometheus-node-exporter.service ]]; then
- apt -y remove --purge prometheus-node-exporter
- rm -fv /lib/systemd/system/prometheus-node-exporter.service
- fi
-
- i /etc/systemd/system/prometheus-node-exporter.service <<'EOF'
-[Unit]
-Description=Prometheus exporter for machine metrics
-Documentation=https://github.com/prometheus/node_exporter
-
-# addition to the distro package
-StartLimitIntervalSec=0
-
-
-[Service]
-Restart=on-failure
-User=prometheus
-EnvironmentFile=/etc/default/prometheus-node-exporter
-ExecStart=/usr/local/bin/prometheus-node-exporter $ARGS
-ExecReload=/bin/kill -HUP $MAINPID
-TimeoutStopSec=20s
-SendSIGKILL=no
-
-# additions to the distro package
-Restart=always
-RestartSec=600
-
-
-[Install]
-WantedBy=multi-user.target
-EOF
- if $sysd_reload; then
- systemctl daemon-reload
- fi
- systemctl enable prometheus-node-exporter
- if $installed_file; then
- systemctl restart prometheus-node-exporter
- fi
-else # not using systemd
- i /etc/init.d/prometheus-node-exporter <<'EOF'
-#!/bin/sh
-# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
-if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
- set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
-fi
-### BEGIN INIT INFO
-# Provides: prometheus-node-exporter
-# Required-Start: $remote_fs
-# Required-Stop: $remote_fs
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Prometheus exporter for machine metrics
-# Description: Prometheus exporter for machine metrics, written in Go
-# with pluggable metric collectors.
-### END INIT INFO
-
-# Author: Martina Ferrari <tina@debian.org>
-# Author: Guillem Jover <gjover@sipwise.com>
-
-DESC="Prometheus exporter for machine metrics"
-NAME=prometheus-node-exporter
-USER=prometheus
-GROUP=$USER
-DAEMON=/usr/bin/$NAME
-PIDFILE=/run/prometheus/$NAME.pid
-LOGFILE=/var/log/prometheus/$NAME.log
-
-START_ARGS="--no-close --background --make-pidfile"
-STOP_ARGS="--remove-pidfile"
-
-do_start_prepare()
-{
- mkdir -p $(dirname $PIDFILE)
-}
-
-do_start_cmd_override()
-{
- start-stop-daemon --start --quiet --oknodo \
- --exec $DAEMON --pidfile $PIDFILE --user $USER --group $GROUP \
- --chuid $USER:$GROUP $START_ARGS -- $ARGS >>$LOGFILE 2>&1
-}
-
-do_stop_cmd_override()
-{
- start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 \
- --exec $DAEMON --pidfile $PIDFILE --user $USER $STOP_ARGS
-}
-
-alias do_reload=do_reload_sigusr1
-EOF
- chmod +x /etc/init.d/prometheus-node-exporter
-
- mkdir -p /var/log/prometheus
- chown prometheus:prometheus /var/log/prometheus
- update-rc.d prometheus-node-exporter defaults
-
- running=false
- if type -t pgrep &>/dev/null && pgrep -f prometheus-node-exporter &>/dev/null; then
- running=true
- fi
- if $installed_file || ! $running; then
- /etc/init.d/prometheus-node-exporter restart
- fi
-
- i /etc/logrotate.d/prometheus-node-exporter <<'EOF'
-/var/log/prometheus/prometheus-node-exporter.log {
- weekly
- rotate 10
- copytruncate
- compress
- delaycompress
- notifempty
- missingok
-}
-EOF
-
-fi
+++ /dev/null
-#!/bin/bash
-
-# I initially was using these
-# https://github.com/cloudalchemy/ansible-prometheus
-# https://github.com/cloudalchemy/ansible-alertmanager
-# https://github.com/cloudalchemy/ansible-node-exporter
-# https://github.com/cloudalchemy/ansible-grafana
-
-# As of trisquel 11, get upstream prom because it has the react ui,
-# which has localtime, and general better usability. alertmanager,
-# changelog seems to show good changes and surely things will just work
-# better with a matching prometheus.
-
-if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
-
-#rsync --delete consoles console_libraries /etc/prometheus
-
-
-while read -r prog tool; do
- cd /a/opt/${prog}dl
- url=$(curl -s https://api.github.com/repos/prometheus/$prog/releases/latest | jq -r '.assets[].browser_download_url | match(".*linux-amd64.tar.gz$").string')
- f=${url##*/}
- if [[ -e $f ]]; then
- timestamp=$(stat -c %Y $f)
- else
- timestamp=0
- fi
- m wget -nv -N $url
- new_timestamp=$(stat -c %Y $f)
- if [[ $timestamp != $new_timestamp || ! -e /usr/local/bin/$prog ]]; then
- ngset
- to_rm=( !($f) )
- ngreset
- if (( ${#to_rm[@]} )); then
- rm -rf ${to_rm[@]}
- fi
- m ex $f
- dir=${f%.tar.gz}
- m sudo install $dir/$prog $dir/$tool /usr/local/bin
- m sudo systemctl restart $prog
- fi
-done <<'EOF'
-prometheus promtool
-alertmanager amtool
-EOF
#!/bin/bash
-# Copyright (C) 2019 Ian Kelling
-# SPDX-License-Identifier: AGPL-3.0-or-later
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
-# alternatively, using https://iankelling.org/git/?p=errhandle;a=tree
-# source /path/errhandle/err
-# on my machine
-source /a/bin/errhandle/err
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+source /a/bin/bash-bear-trap/bash-bear
source /a/bin/distro-functions/src/package-manager-abstractions
PATH="$PATH:$HOME/.cargo/bin"
if type -t rustc &>/dev/null; then
rustup update
else
- curl https://sh.rustup.rs -sSf | bash -s -- -y
+
+ # added stable due to this error
+# Mar 11 00:13:15 info: no updatable toolchains installed
+# Mar 11 00:13:15 info: checking for self-update
+# Mar 11 00:13:15 info: cleaning up downloads & tmp directories
+# Mar 11 00:13:15 error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
+# Mar 11 00:13:15 help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
+# Mar 11 00:13:15 /a/bin/buildscripts/rust:31: `cargo install-update -a' returned 1
+
+ curl https://sh.rustup.rs -sSf | bash -s -- --default-toolchain stable -y
fi
if ! which rg &>/dev/null; then
fi
cargo install-update -a
+
+# https://github.com/rust-lang/cargo/issues/3289
+# 149 mb on fresh install as of 07-2023
+if du -s -t 500M ~/.cargo/registry | grep . &>/dev/null; then
+ rm -rf ~/.cargo/registry
+fi
#!/bin/bash
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+
if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi
+++ /dev/null
-#!/bin/bash
-
-
-x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
-for x in *; do
- if [[ $x == update-builds || ! -x $x || -d $x ]]; then
- continue
- fi
- $x -u
-done