--- /dev/null
+#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+source /a/bin/errhandle/err
+source /a/bin/distro-functions/src/package-manager-abstractions
+
+
+pi cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3
+cd /a/opt/alacritty
+cargo build --release
+sudo mkdir -p /usr/local/share/man/man1
+gzip -c extra/alacritty.man | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null
+sudo rsync -at /a/opt/alacritty/target/release/alacritty /usr/local/bin
bootstrap=false
recompile=false
show_pkgs=false
+dryrun=false
while [[ $1 == -* ]]; do
case $1 in
-b) bootstrap=true; recompile=true ;;
+ -n) dryrun=true ;;
-r) recompile=true ;;
--no-r) recompile=false ;;
-u) update=true ;;
fi
done
-pkgs=(gawk attr autoconf-archive git install-info)
+# ccache is a missing build dep for mu
+pkgs=(gawk attr autoconf-archive git install-info ccache)
##### warning, apt-rdepends seems to look at the newest version of the package,
##### not the one that build-dep would install.
if $show_pkgs; then
# e/e because autofs failing to mount will make it so
# you cant ls whatever directory it is in, so we
-# need an extra directory
-dirs=($dir $dir-nox/.iank/e/e)
+# need an extra directory. i dunno why this was like this instead of just $dir-nox.
+#dirs=($dir $dir-nox/.iank/e/e)
+
+dirs=($dir $dir-nox)
+
if [[ -e $dir ]]; then
m cd $dir
bootstrap=true
fi
+if $dryrun; then
+ echo recompile=$recompile bootstrap=$bootstrap update=$update
+ exit 0
+fi
+
if $bootstrap; then
m rsync --delete -ra /a/opt/emacs/ $dir
recompile=true
;;&
debian|ubuntu|trisquel)
# todo: unknown for other distros, this will fail
- logq p -y build-dep maildir-utils/$(debian-codename)
+ logq p -y build-dep maildir-utils
# oddly, on ubuntu 14.04 this installs postfix, but I dun care
# ubuntu 14.04 gave this error message
# Unable to satisfy the build-depends: Build-Depends: libpng-dev
nox=false
for d in ${dirs[@]}; do
if $nox; then
- # todo: this doesnt account for
- m mkdir -p ${d%/*}
+ # Commented stuff in this block had something to do with ssh / autofs, im not really using nox right now,
+ # so unless I figure out why it was this way, ignore this.
+ # m mkdir -p ${d%/*}
m rsync --delete -ra $dir/ $d
- mp=$HOME/.iank/e/e
- if mountpoint $mp &>/dev/null; then
- m sudo umount $mp
- fi
- m mkdir -p $mp
- m sudo mount -o bind $d $mp
- m sudo chown $USER:$USER $mp
- m cd $mp
+ #
+ # mp=$HOME/.iank/e/e
+ # if mountpoint $mp &>/dev/null; then
+ # m sudo umount $mp
+ # fi
+ # m mkdir -p $mp
+ # m sudo mount -o bind $d $mp
+ # m sudo chown $USER:$USER $mp
+ # m cd $mp
+
+ # instead of $mp above
+ m cd $d
else
m cd $d
fi
--- /dev/null
+#!/bin/bash
+
+source /a/bin/errhandle/err
+
+if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi
+
+rebuild=false
+case $1 in
+ -r) rebuild=true ;;
+esac
+
+# https://sw.kovidgoyal.net/kitty/build/
+deps=(
+ libdbus-1-dev
+ libxcursor-dev
+ libxrandr-dev
+ libxi-dev
+ libxinerama-dev
+ libgl1-mesa-dev
+ libxkbcommon-x11-dev
+ libfontconfig-dev
+ libx11-xcb-dev
+ liblcms2-dev
+ libpython3-dev
+ librsync-dev
+)
+
+pi ${deps[@]}
+
+cd /a/opt/kitty
+rev=$(cat $last_build 2>/dev/null) ||:
+head=$(git rev-parse HEAD)
+if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
+ :
+fi
+
+
+# built it on one machine, the others it dies with the error illegal
+# instruction. building is pretty quick, so just detect if our version
+# works, and if not, rebuild and install.
+# I had an idea to test the failure like so:
+# timeout 5 kitty /bin/true, but that doesn't work over ssh
+if ! $rebuild && ! /bin/true; then
+ rebuild=true
+fi
+
+if $rebuild; then
+ s mkdir -p /usr/local/src/kitty
+ s mount -o bind /a/opt/kitty /usr/local/src/kitty
+
+ s install -o zu -g zu -d /usr/local/src/kitty
+ s chown -hR zu.zu /usr/local/src/kitty
+ cd /usr/local/src/kitty
+ m sudo -u zu firejail --read-write=/usr/local/src/kitty --profile=makekitty make clean
+ m sudo -u zu firejail --read-write=/usr/local/src/kitty --profile=makekitty make
+ cd /
+ s umount /usr/local/src/kitty
+ s chown -hR iank.iank /a/opt/kitty
+fi
+
+cd /a/opt/kitty
+s rsync -ar --chown root:root --delete __main__.py kitty logo kittens /usr/local/src/kitty
+s rsync -ar --chown root:root ./terminfo/x/xterm-kitty /usr/share/terminfo/x/xterm-kitty
+s ln -sf -T /usr/local/src/kitty/kitty/launcher/kitty /usr/local/bin/kitty
--- /dev/null
+#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+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
+
+if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
+
+deps=(
+ build-essential
+ cmake
+ pkg-config
+ qt5-default
+ qttools5-dev
+ qttools5-dev-tools
+ libqt5svg5-dev
+ libboost-dev
+ libssl-dev
+ libprotobuf-dev
+ protobuf-compiler
+ libprotoc-dev
+ libcap-dev
+ libxi-dev
+ libasound2-dev
+ libogg-dev
+ libsndfile1-dev
+ libspeechd-dev
+ libavahi-compat-libdnssd-dev
+ libxcb-xinerama0
+ libzeroc-ice-dev
+ libpoco-dev
+)
+pi ${deps[@]}
+
+mkc /a/opt/mumble/build
+
+# just looked through cmake_options.md and picked things that looked good. oss, alsa, portaudio, pipewire are off just to avoid superflous options we dont use.
+cmake -Dcoreaudio=OFF -Dzeroconf=OFF -Doss=OFF -Dportaudio=OFF -Dalsa=OFF -Dpipewire=OFF -Dserver=OFF -Doverlay-xcompile=OFF -Doverlay=OFF -Dupdate=OFF -Dwasapi=OFF -Dxboxinput=OFF -Dlto=ON -Doptimize=ON ..
+
+make -j $(nproc)
--- /dev/null
+#!/bin/bash
+
+#https://github.com/nodesource/distributions/blob/master/README.md
+KEYRING=/usr/share/keyrings/nodesource.gpg
+curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo dd of=$KEYRING 2>/dev/null
+
+
+# Replace with the branch of Node.js or io.js you want to install: node_6.x, node_8.x, etc...
+VERSION=node_16.x
+# Replace with the keyring above, if different
+KEYRING=/usr/share/keyrings/nodesource.gpg
+# The below command will set this correctly, but if lsb_release isn't available, you can set it manually:
+# - For Debian distributions: jessie, sid, etc...
+# - For Ubuntu distributions: xenial, bionic, etc...
+# - For Debian or Ubuntu derived distributions your best option is to use the codename corresponding to the upstream release your distribution is based off. This is an advanced scenario and unsupported if your distribution is not listed as supported per earlier in this README.
+DISTRO=focal
+echo "deb [signed-by=$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
+echo "deb-src [signed-by=$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
--- /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.
+ARGS="--web.listen-address=${listen_address}:9100"
+# to see all possible args, run with --help
+EOF
+
+if [[ -d /etc/systemd/system ]]; then # we are using systemd
+ if [[ -e /lib/systemd/system/prometheus-node-exporter.service ]]; then
+ i /etc/systemd/system/prometheus.service.d/override.conf <<'EOF'
+[Unit]
+# needed to continually restart
+StartLimitIntervalSec=0
+
+[Service]
+Restart=always
+# time to sleep before restarting a service
+RestartSec=600
+
+# empty signifies to replace the existing value
+ExecStart=
+ExecStart=/usr/local/bin/prometheus $ARGS
+EOF
+ else # we dont have the distro package installed
+ i /etc/systemd/system/prometheus.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
+ fi
+ 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
# See the License for the specific language governing permissions and
# limitations under the License.
-if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
+if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi
# stable version is shown on:
# we exclude verions with letters, as that seems to
# be a relatively reliable indication of alpha/beta releases.
-vers=($(curl -s https://dist.torproject.org/torbrowser/ \
- | sed -rn 's#.*href="([0-9]+\.[0-9]+[.0-9]*)/.*#\1#p' \
- | sort -Vr))
-
-
+# Their server has failed a few times on me, so do some retrying.
+for (( i=0; i <= 6 ; i++ )); do
+ c=$(curl -s https://dist.torproject.org/torbrowser/) && break
+ sleep 15
+done
+if [[ ! $c ]]; then
+ 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))
# by default it has perms for just 1 non-root user, which is ok for now.