#!/bin/sh set -eu bell () { printf '\\a' } wall () { $(command -v wall) "$(id -g)" } notify_send () { message="$(cat)" $(command -v notify-send) "$@" "$message" } nextcloud () { message="$(cat)" curl -d "$message" https://notify.shore.co.il/send } # Try hostname if present. if command -v hostname > /dev/null then hostname="$(hostname)" # Try using sysfs (Linux only). elif [ -f /proc/sys/kernel/hostname ] then hostname="$(cat /proc/sys/kernel/hostname)" # Fallback to grepping sysctl. else hostname="$(sysctl -a 2>/dev/null | awk -F '=' '/^kern[a-z]*\.hostname/ {print $2}')" fi # Get the host' hostname in case if [ "$hostname" = 'toolbox' ] then hostname="$(/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host hostname)" fi #FIXME: Remove domain, just hostname. case "$hostname" in ea6350) nextcloud;; ElementaryOS) nextcloud;; host01) nextcloud;; kodi) nextcloud;; ns1) nextcloud;; ns4) nextcloud;; YOGA-C930) notify_send "$@";; *) ;; esac