From 732876299f4dccb4caa3a915879d2b5945bbdd42 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Apr 2014 11:15:54 +0200 Subject: filehooker is now elchOS --- filehooker/root-image/krebs/lib/_punani_db | 57 ----------- filehooker/root-image/krebs/lib/color | 7 -- filehooker/root-image/krebs/lib/core | 80 --------------- filehooker/root-image/krebs/lib/filehooker | 152 ----------------------------- filehooker/root-image/krebs/lib/iso | 7 -- filehooker/root-image/krebs/lib/krebs | 16 --- filehooker/root-image/krebs/lib/network | 100 ------------------- filehooker/root-image/krebs/lib/punani | 99 ------------------- filehooker/root-image/krebs/lib/retiolum | 99 ------------------- filehooker/root-image/krebs/lib/tahoe | 34 ------- filehooker/root-image/krebs/lib/tor | 19 ---- filehooker/root-image/krebs/lib/vim | 40 -------- 12 files changed, 710 deletions(-) delete mode 100644 filehooker/root-image/krebs/lib/_punani_db delete mode 100644 filehooker/root-image/krebs/lib/color delete mode 100644 filehooker/root-image/krebs/lib/core delete mode 100644 filehooker/root-image/krebs/lib/filehooker delete mode 100644 filehooker/root-image/krebs/lib/iso delete mode 100644 filehooker/root-image/krebs/lib/krebs delete mode 100644 filehooker/root-image/krebs/lib/network delete mode 100644 filehooker/root-image/krebs/lib/punani delete mode 100644 filehooker/root-image/krebs/lib/retiolum delete mode 100644 filehooker/root-image/krebs/lib/tahoe delete mode 100644 filehooker/root-image/krebs/lib/tor delete mode 100644 filehooker/root-image/krebs/lib/vim (limited to 'filehooker/root-image/krebs/lib') diff --git a/filehooker/root-image/krebs/lib/_punani_db b/filehooker/root-image/krebs/lib/_punani_db deleted file mode 100644 index e5bf15b1..00000000 --- a/filehooker/root-image/krebs/lib/_punani_db +++ /dev/null @@ -1,57 +0,0 @@ -_punanidb_pacman_= -_punanidb_yum_= -_punanidb_aptget_= - -_punanidb_pacman_git=git -_punanidb_yum_git=git -_punanidb_aptget_git=git-core - -_punanidb_pacman_python2=python2 -_punanidb_yum_python2=python -_punanidb_aptget_python2=python - -_punanidb_pacman_python3=python -_punanidb_aptget_python3=python3 - -_punanidb_pacman_pip2=python2-pip -_punanidb_aptget_pip2=python-pip - -_punanidb_pacman_virtualenv=python-virtualenv -_punanidb_aptget_virtualenv=python-virtualenv - -_punanidb_pacman_gpp=g++ -_punanidb_aptget_gpp=gcc - -_punanidb_pacman_python2_dev=python2 -_punanidb_aptget_python2_dev=python-dev - -_punanidb_pacman_hostname=inetutils -_punanidb_aptget_hostname=hostname - -_punanidb_pacman_hostname=inetutils -_punanidb_aptget_hostname=hostname - -_punanidb_pacman_make=make -_punanidb_yum_make=make -_punanidb_aptget_make=make - -_punanidb_pacman_tinc=tinc -_punanidb_yum_tinc=tinc -_punanidb_aptget_tinc=tinc - -_punanidb_pacman_zsh=zsh -_punanidb_yum_zsh=zsh -_punanidb_aptget_zsh=zsh - -_punanidb_pacman_tor=tor -_punanidb_yum_tor=tor -_punanidb_aptget_tor=tor - -_punanidb_pacman_nano=nano -_punanidb_yum_nano=nano -_punanidb_aptget_nano=nano - -_punanidb_pacman_vim=vim -_punanidb_yum_vim=vim-enhanced -_punanidb_aptget_vim=vim - diff --git a/filehooker/root-image/krebs/lib/color b/filehooker/root-image/krebs/lib/color deleted file mode 100644 index cec2044e..00000000 --- a/filehooker/root-image/krebs/lib/color +++ /dev/null @@ -1,7 +0,0 @@ -# superseed logging with color -green='\e[0;32m' -red='\e[0;31m' -nc='\e[0m' -msg() { printf "$*\n" >&2; } -info() { msg "$green$*$nc"; } -error() { msg "$green$*$nc"; } diff --git a/filehooker/root-image/krebs/lib/core b/filehooker/root-image/krebs/lib/core deleted file mode 100644 index 0c321525..00000000 --- a/filehooker/root-image/krebs/lib/core +++ /dev/null @@ -1,80 +0,0 @@ -# logging -msg() { echo "$*" >&2; } -info() { msg "** $*"; } -error() { msg "!! $*"; } -## usage: die [REASON...] -die() { - test $# -gt 0 && error "$*" - error 'Bailing out.' - exit 1 -} -exists(){ - type "$1" >/dev/null 2>/dev/null; -} - -is_root(){ - test $(id -u) -eq 0 -} - -defer(){ - #close enough - trapstr="$1;${trapstr:-exit}" - trap "$trapstr" INT TERM EXIT KILL -} - -esudo(){ - # weaksauce esudo (expect sudo) - if ! is_root; then - # for the record: - # exec sudo -E "$0" "$@" - error "You are not root enough for this script" - exit 23 # go to hell - fi -} - -get_hostname(){ - # finds the current hostname - # if ENV HOSTN is set echo $HOSTN - # We try the following: - # $HOSTN - # $HOSTNAME - # hostname - # uci system.hostname - # /etc/hostname - # if everything fails, it returns 1 and prints 'unknown' - - if [ -n "${HOSTN:-}" ] ; then printf "${HOSTN:-}" - elif [ -n "${HOSTNAME:-}" ] ;then printf "$HOSTNAME" - elif exists hostname ; then printf "$(hostname)" - elif exists uci ; then printf "$(uci get system.@system[0].hostname)" - elif [ -e /etc/hostname ] ;then printf "$(cat /etc/hostname)" - else printf "unknown"; return 1 - fi - return 0 -} - -line_to_dot(){ - while read line; do printf .; done; -} - -get_os(){ - # TODO: find all the release files - #if grep -q 'Linux' /etc/*release 2>/dev/null || grep -qe 'Linux' /etc/issue 2>/dev/null; then - if grep -q 'Linux' /etc/lsb-release 2>/dev/null || grep -q 'Linux' /etc/issue 2>/dev/null; then - echo 'linux' - elif test -e /etc/preferred-apps/google.xml; then - echo 'android' - elif test -e /etc/openwrt_release; then - echo 'openwrt' - elif uname -s | grep -qi 'darwin'; then - echo 'osx' - else - warn "Cannot determine your operating system, falling back to Linux" - echo 'linux' - fi -} - -# user management -has_user(){ - egrep "^$1:" /etc/passwd >/dev/null -} diff --git a/filehooker/root-image/krebs/lib/filehooker b/filehooker/root-image/krebs/lib/filehooker deleted file mode 100644 index b3bef435..00000000 --- a/filehooker/root-image/krebs/lib/filehooker +++ /dev/null @@ -1,152 +0,0 @@ -#@include core -. /krebs/lib/core -#@include network -. /krebs/lib/network -ncdc_user=${ncdc_user:-hooker} -ncdc_bin=${ncdc_bin:-/usr/bin/ncdc} - - -ncdc_config(){ - # maybe we want to use the running ncdc process and communicate via tmux send-keys ? - txt="$(cat)" -# printf "%s" "$txt" - ! sudo -u $ncdc_user /usr/bin/tmux has-session -t dcpp && echo "ncdc session must be running" && exit 1 - sudo -u $ncdc_user /usr/bin/tmux send-keys -t dcpp:ncdc "$txt" C-m -} - -ncdc_configure_netshare(){ - : "${1?provide path to share}" - rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` - rnd_name="${2:-share_$rnd}" - info "removing old share $rnd_name" - (echo "/unshare $rnd_name" ) | ncdc_config - info "adding share $rnd_name ($1)" - (echo "/share $rnd_name $1") | ncdc_config -} - -ncdc_configure_nick(){ - nick=${1?nick must be provided} - info "configuring DC Nick: $nick" - echo "/nick $nick" | ncdc_config -} -ncdc_configure_hub(){ - rnd=`hexdump -n 2 -e '/2 "%u"' /dev/urandom` - hub=${1?adcs://localhost:2781} - hubname="${2:-hub_$rnd}" - info "setting active as true" - (echo "/set active true") | ncdc_config - info "configuring DC Hub: $hub, activating autconnect" - (echo "/open ${hubname} ${hub}" ; - echo "/hset autoconnect true") | ncdc_config -} - -ncdc_download(){ -install_dir="$(dirname "${ncdc_bin}")" -info "installing ncdc to $install_dir" -curl http://dev.yorhel.nl/download/ncdc-linux-x86_64-1.19.tar.gz | tar xz -C "$install_dir" -} -ncdc_install(){ -useradd -m $ncdc_user ||: -} - -ncdc_autostart(){ -# only systemd -# punani install tmux -cat > /etc/systemd/system/ncdc@.service </dev/null - sleep 1 - (printf "o\nn\np\n\n\n\nw\n\n") |fdisk $disk >/dev/null ||: - #partprobe $disk - mkfs.btrfs -f ${disk}1 >/dev/null - uuid="$(blkid ${disk}1 -o value | head -n 1)" - mountpoint="/media/vag${count}" - mkdir -p "$mountpoint" - echo "UUID=$uuid $mountpoint btrfs rw,relatime,space_cache 0 0" >> /etc/fstab - echo "$mountpoint" - : $((count++)) - else - info "skipping $disk" - fi - done -} -install_tor_announce(){ -# systemd only -info "writing tor_announce.service" -cat > /etc/systemd/system/tor_announce.service<