From d16f89c3016e8ff0da08a85e8d51b79b552a7c5c Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Sep 2013 15:38:14 +0200 Subject: add core libs --- lib/core | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/core diff --git a/lib/core b/lib/core new file mode 100644 index 00000000..f6516b5e --- /dev/null +++ b/lib/core @@ -0,0 +1,32 @@ +#!/bin/sh + +# logging +msg() { printf "$@\n" >&2 ;} +info() { msg "** $@" ;} +error() { msg "!! $@" ;} +exists(){ type "$1" >/dev/null 2>/dev/null; } + +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; +} -- cgit v1.2.3 From b4b735b6a1e14de84edd40ad2badcc1746235696 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Sep 2013 15:38:30 +0200 Subject: add network libs --- lib/network | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/network diff --git a/lib/network b/lib/network new file mode 100644 index 00000000..9d7ea197 --- /dev/null +++ b/lib/network @@ -0,0 +1,49 @@ +#!/bin/sh +#include core + +anytelnet(){ + # find Telnet or similar and executes it at the end + # requires exist + # if env TELNET is set, will be trying to run this + # Tries the following things: + # telnet + # nc + # netcat + # busybox telnet + if [ -e "${TELNET:-does_not_exist}" ]; then + info"Will be using $TELNET as Telnet Client" + elif exists telnet ;then + TELNET="$(command -v telnet)" + elif exists nc ;then + TELNET="$(command -v nc)" + elif exists netcat;then + TELNET="$(command -v netcat)" + elif exists busybox;then + TELNET="$(command -v busybox) telnet" + else + error "Cannot find telnet binary, please install either telnet-client or busybox or netcat or provided TELNET environment.\nbailing out!" + return 1 + fi + $TELNET $@ +} + +send_irc(){ + ## reads from stdin, writes to IRC + ## + ## requires func: exists() anytelnet() + if [ -z "${HOSTN:-}" ]; then + HOSTN="$(get_hostname)" + info "no HOSTN given, using $HOSTN instead" + fi + IRCCHANNEL=${IRCCHANNEL:-"#krebs_incoming"} + IRCSERVER=${IRCSERVER:-"irc.freenode.net"} + IRCPORT=${IRCPORT:-6667} + NICK="${HOSTN}_$(head /dev/urandom | tr -dc "0123456789" | head -c3)" + info "starting irc connect as $NICK" + ( echo "NICK $NICK"; + echo "USER $NICK $IRCSERVER bla : $NICK"; + echo "JOIN $IRCCHANNEL"; + sleep 23; + while read line; do echo "PRIVMSG $IRCCHANNEL :$line";sleep 1;done + sleep 5; ) | anytelnet $IRCSERVER $IRCPORT 2>/dev/null | line_to_dot +} -- cgit v1.2.3 From 473981b112d89bf6401be7e164bca4b91b1cdb2b Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Sep 2013 16:06:27 +0200 Subject: add is_root to core --- lib/core | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core b/lib/core index f6516b5e..6d126142 100644 --- a/lib/core +++ b/lib/core @@ -5,7 +5,9 @@ msg() { printf "$@\n" >&2 ;} info() { msg "** $@" ;} error() { msg "!! $@" ;} exists(){ type "$1" >/dev/null 2>/dev/null; } - +is_root(){ + test $(id -u) -eq 0 +} get_hostname(){ # finds the current hostname # if ENV HOSTN is set echo $HOSTN -- cgit v1.2.3 From 95ded8a1f117b15ef246e1e3d86d25b561de5bcf Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Sep 2013 16:06:38 +0200 Subject: add develop script the script exports source_all which sources all the files in the folder --- develop | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 develop diff --git a/develop b/develop new file mode 100644 index 00000000..a961f9c2 --- /dev/null +++ b/develop @@ -0,0 +1,5 @@ +#!/bin/sh +source_all(){ + LIBDIR=${1:-.} + for i in $LIBDIR/*; do . "$i"; done +} -- cgit v1.2.3 From e05fe8ad0b97776afc4c996c70b5c634b8f22456 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 27 Sep 2013 16:07:45 +0200 Subject: porting punani to local_db from //punani/bin --- lib/punani | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 lib/punani diff --git a/lib/punani b/lib/punani new file mode 100644 index 00000000..d2bcbed2 --- /dev/null +++ b/lib/punani @@ -0,0 +1,93 @@ +#!/bin/sh +#include core + +## begin punani DB +punani_pacman_= +punani_yum_= +punani_aptget_= + +punani_pacman_git=git +punani_yum_git=git +punani_aptget_git=git-core + +punani_pacman_python2=python2 +punani_yum_python2=python +punani_aptget_python2=python + +punani_pacman_python3=python +punani_aptget_python3=python3 + +punani_pacman_hostname=inetutils +punani_aptget_hostname=hostname + +punani_pacman_hostname=inetutils +punani_aptget_hostname=hostname + +punani_pacman_make=make +punani_yum_make=make +punani_aptget_make=make + +punani_pacman_tinc=tinc +punani_yum_tinc=tinc +punani_aptget_tinc=tinc + +punani_pacman_nano=nano +punani_yum_nano=nano +punani_aptget_nano=nano +## end punani DB + +punani_resolve_package(){ + : ${PACKER_CMD?PACKER_CMD is not set,bailing out} + pkg=${1?please provide package name to resolve} + PACKER_DB=$(printf ${PACKER_CMD}| sed 's/-//g') + eval printf \"\${punani_${PACKER_DB}_${pkg}-}\" | grep . +} +punani(){ + ! is_root && error "punani requires super-user rights" && return 1 + ACTION="$1"; shift + PKGS="$*" + if ! :; then : # dummy case, so the rest has a common format + elif exists apt-get;then + PACKER_CMD='apt-get' + INSTALL_PARAM='-y install' + REMOVE_PARAM='-y remove' + elif exists pacman;then + PACKER_CMD='pacman' + INSTALL_PARAM='--noconfirm -S --needed' + REMOVE_PARAM='-Rcs' + elif exists yum;then + PACKER_CMD='yum' + INSTALL_PARAM='-y install' + REMOVE_PARAM='-y remove' + elif exists brew;then + PACKER_CMD='brew' + INSTALL_PARAM='install' + REMOVE_PARAM='remove' + else + error "Error 2: no known package manager found; no punani for you!" + return 1 + fi + info "using $PACKER_CMD for install" + RESOLVED="" + if test -n "$PKGS"; then + for PKG in $PKGS; do + RES="$(punani_resolve_package $PKG)" + test -z "$RES" && error "could not resolve '$PKG'; no punani for you!"&& return 23 + RESOLVED="${RESOLVED+$RESOLVED }$RES" + done + else + error "no PACKAGE specified." + ACTION="usage" + fi + case "$ACTION" in + install) + eval $PACKER_CMD $INSTALL_PARAM $RESOLVED || error "Cannot install $PKG!" + ;; + remove) + eval $PACKER_CMD $REMOVE_PARAM $RESOLVED || error "Cannot remove $PKG!" + ;; + *) + error "usage: punani (install|remove) PACKAGE..." + return 23 + esac +} -- cgit v1.2.3 From 38af6027ee06f4cd8427e515a3492dd5f060db37 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 31 Oct 2013 12:30:25 +0100 Subject: make-realwallpaper: sep. in_size/xplanet_out_size --- util/bin/make-realwallpaper | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index 437919b5..ec7ca538 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -24,7 +24,8 @@ main() { check_type daymap-raw.png image check_type clouds-raw.jpg image - in_size=1466x1200 + in_size=2048x1024 + xplanet_out_size=1466x1200 out_geometry=1366x768+100+160 nightsnow_color='#0c1a49' # nightmap @@ -117,11 +118,11 @@ EOF EOF # rebuild every time to update shadow - xplanet --num_times 1 --geometry $in_size \ + xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-output.png --projection merc -config xplanet.config # rebuild everytime satellite version - xplanet --num_times 1 --geometry $in_size \ + xplanet --num_times 1 --geometry $xplanet_out_size \ --output xplanet-sat-output.png --projection merc -config xplanet-sat.config # trim xplanet output -- cgit v1.2.3 From 5e3c03f8657f6666e7f71a31a9444e9db2f659d0 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 31 Oct 2013 12:32:39 +0100 Subject: make-realwallpaper: fix indentation --- util/bin/make-realwallpaper | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index 30bfa2fa..8187c088 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -85,7 +85,7 @@ main() { done # create xplanet output - cat >xplanet.config <xplanet.config <xplanet-sat.config <xplanet-sat.config < Date: Fri, 1 Nov 2013 18:33:12 +0100 Subject: make-realwallpaper fetch sat. data in parallel --- util/bin/make-realwallpaper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index 8187c088..6e1abf40 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -16,7 +16,7 @@ main() { fetch clouds-raw.jpg \ http://user.chol.com/~winxplanet/cloud_data/clouds_2048.jpg & fetch krebs.sat.tle \ - http://www.celestrak.com/NORAD/elements/stations.txt + http://www.celestrak.com/NORAD/elements/stations.txt & wait #check_type nightmap-old-raw.jpg image -- cgit v1.2.3 From ff0f82e81b075aca030674af6f3b1bee14a644ff Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 1 Nov 2013 18:36:02 +0100 Subject: make-realwallpaper define maps for *.config once --- util/bin/make-realwallpaper | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index 6e1abf40..e1e3f5c2 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -84,13 +84,18 @@ main() { ln $normal $final done + map=daymap-final.png + night_map=nightmap-final.png + cloud_map=clouds-final.png + satellite_file=krebs.sat + # create xplanet output cat >xplanet.config <xplanet-sat.config < Date: Fri, 1 Nov 2013 18:48:05 +0100 Subject: make-realwallpaper add gclouds --- util/bin/make-realwallpaper | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index e1e3f5c2..14f6b052 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -84,9 +84,11 @@ main() { ln $normal $final done + make_gcloud_cloudmask + map=daymap-final.png night_map=nightmap-final.png - cloud_map=clouds-final.png + cloud_map=gcloud-cloudmask.png satellite_file=krebs.sat # create xplanet output @@ -143,6 +145,43 @@ EOF && convert xplanet-sat-output.png -crop $out_geometry realwallpaper-sat.png } +# generate clouds from google maps +make_gcloud_cloudmask() { + echo 'fetch gcloud-*.png tiles' >&2 + for y in $(seq -w 0 15); do + for x in $(seq -w 0 15); do + echo "curl -sS -o gcloud-$y-$x.png -z gcloud-$y-$x.png \\\"https://mts0.google.com/vt/lyrs=h@239000000,weather_nolabels,weather_0cloud&hl=en&src=app&x=$x&y=$y&z=4&s=Galil\\\"" + done + done | xargs --max-args=1 -P 10 -I @ sh -c @ + gcloud_tiles=$(find -name 'gcloud-[0-9][0-9]-[0-9][0-9].png'|sort) + needs_rebuild gcloud-raw.png $gcloud_tiles && + echo 'make gcloud-raw.png' && + montage -mode Concatenate -background None \ + $gcloud_tiles -tile x16 gcloud-raw.png + + check_type gcloud-raw.png image + + gcloud_in_size=2048x2048 + gcloud_out_size=2048x1024 + gcloud_out_geometry=2048x1024+0+512 + gcloud_base_color='#ffffff' + + needs_rebuild gcloud-normal.png gcloud-raw.png && + echo "make gcloud-normal.png; normalize gcloud-raw.png" >&2 + convert gcloud-raw.png -scale $gcloud_in_size gcloud-normal.png + + needs_rebuild gcloud-cloudmask.png gcloud-normal.png && + echo 'make gcloud-cloudmask.png' && + convert -flatten gcloud-normal.png \ + -fx 'p{i,(asinh(tan((j/h+0.5)*pi))/2.6+0.5)*h}' \ + -crop $gcloud_out_geometry \ + gcloud-cloudmask.png + + needs_rebuild gcloud-fullcloud.png && + echo 'make gcloud-fullcloud.png' && + convert -size $gcloud_out_size xc:$gcloud_base_color gcloud-fullcloud.png +} + # usage: getimg FILENAME URL fetch() { echo "fetch $1" -- cgit v1.2.3 From a7c63807b827010c266f0a8cc1170b6e2cf0228a Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 2 Nov 2013 00:41:34 +0100 Subject: archlive image builder with hidden_service com --- util/archlive/archlive.tar | Bin 0 -> 58785 bytes util/archlive/readme | 7 +++++++ 2 files changed, 7 insertions(+) create mode 100644 util/archlive/archlive.tar create mode 100644 util/archlive/readme diff --git a/util/archlive/archlive.tar b/util/archlive/archlive.tar new file mode 100644 index 00000000..13878e24 Binary files /dev/null and b/util/archlive/archlive.tar differ diff --git a/util/archlive/readme b/util/archlive/readme new file mode 100644 index 00000000..bb23a942 --- /dev/null +++ b/util/archlive/readme @@ -0,0 +1,7 @@ +change key in root-image/root/.ssh/authorized_keys +change target hidden service in root-image/etc/systemd/scripts/nc_onion + +run build.sh (as root) + +archlive will send the hidden service every minute to configured targets hidden service +stop with systemctl stop krebs-init -- cgit v1.2.3 From c88d66a0cbaa2baa258f212cb39fb940b86d2d30 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 2 Nov 2013 02:00:39 +0100 Subject: refactor punani --- lib/punani | 155 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 83 insertions(+), 72 deletions(-) diff --git a/lib/punani b/lib/punani index d2bcbed2..41c59a46 100644 --- a/lib/punani +++ b/lib/punani @@ -2,92 +2,103 @@ #include core ## begin punani DB -punani_pacman_= -punani_yum_= -punani_aptget_= +_punanidb_pacman_= +_punanidb_yum_= +_punanidb_aptget_= -punani_pacman_git=git -punani_yum_git=git -punani_aptget_git=git-core +_punanidb_pacman_git=git +_punanidb_yum_git=git +_punanidb_aptget_git=git-core -punani_pacman_python2=python2 -punani_yum_python2=python -punani_aptget_python2=python +_punanidb_pacman_python2=python2 +_punanidb_yum_python2=python +_punanidb_aptget_python2=python -punani_pacman_python3=python -punani_aptget_python3=python3 +_punanidb_pacman_python3=python +_punanidb_aptget_python3=python3 -punani_pacman_hostname=inetutils -punani_aptget_hostname=hostname +_punanidb_pacman_hostname=inetutils +_punanidb_aptget_hostname=hostname -punani_pacman_hostname=inetutils -punani_aptget_hostname=hostname +_punanidb_pacman_hostname=inetutils +_punanidb_aptget_hostname=hostname -punani_pacman_make=make -punani_yum_make=make -punani_aptget_make=make +_punanidb_pacman_make=make +_punanidb_yum_make=make +_punanidb_aptget_make=make -punani_pacman_tinc=tinc -punani_yum_tinc=tinc -punani_aptget_tinc=tinc +_punanidb_pacman_tinc=tinc +_punanidb_yum_tinc=tinc +_punanidb_aptget_tinc=tinc + +_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 -punani_pacman_nano=nano -punani_yum_nano=nano -punani_aptget_nano=nano ## end punani DB -punani_resolve_package(){ - : ${PACKER_CMD?PACKER_CMD is not set,bailing out} +_punani_resolve_package(){ + : ${PACKER?PACKER is not set,bailing out} pkg=${1?please provide package name to resolve} - PACKER_DB=$(printf ${PACKER_CMD}| sed 's/-//g') - eval printf \"\${punani_${PACKER_DB}_${pkg}-}\" | grep . + eval printf \"\${_punanidb_${PACKER_DB}_${pkg}-}\" | grep . } +_punani_aptget_install(){ apt-get -y install "$@" ;} +_punani_aptget_remove(){ apt-get -y remove "$@" ;} +_punani_aptget_has() { dpkg -s "$1" >/dev/null 2>/dev/null ;} +_punani_yum_install(){ yum -y install "$@" ;} +_punani_yum_remove(){ yum -y remove "$@" ;} +_punani_yum_has() { rpm -qa --qf "%{NAME}\n"| egrep "^${1}\$" >/dev/null ;} +_punani_pacman_install(){ pacman --noconfirm -S --needed "$@" ;} +_punani_pacman_remove(){ pacman -Rcs "$@" ;} +_punani_pacman_has(){ pacman -Q "$1" >/dev/null;} +_punani_brew_install(){ brew install "$@"; } +_punani_brew_remove(){ brew remove "$@";} +_punani_brew_has(){ error "not implemented"; return 1 ;} + punani(){ ! is_root && error "punani requires super-user rights" && return 1 ACTION="$1"; shift PKGS="$*" - if ! :; then : # dummy case, so the rest has a common format - elif exists apt-get;then - PACKER_CMD='apt-get' - INSTALL_PARAM='-y install' - REMOVE_PARAM='-y remove' - elif exists pacman;then - PACKER_CMD='pacman' - INSTALL_PARAM='--noconfirm -S --needed' - REMOVE_PARAM='-Rcs' - elif exists yum;then - PACKER_CMD='yum' - INSTALL_PARAM='-y install' - REMOVE_PARAM='-y remove' - elif exists brew;then - PACKER_CMD='brew' - INSTALL_PARAM='install' - REMOVE_PARAM='remove' - else - error "Error 2: no known package manager found; no punani for you!" - return 1 - fi - info "using $PACKER_CMD for install" - RESOLVED="" - if test -n "$PKGS"; then - for PKG in $PKGS; do - RES="$(punani_resolve_package $PKG)" - test -z "$RES" && error "could not resolve '$PKG'; no punani for you!"&& return 23 - RESOLVED="${RESOLVED+$RESOLVED }$RES" - done - else - error "no PACKAGE specified." - ACTION="usage" - fi - case "$ACTION" in - install) - eval $PACKER_CMD $INSTALL_PARAM $RESOLVED || error "Cannot install $PKG!" - ;; - remove) - eval $PACKER_CMD $REMOVE_PARAM $RESOLVED || error "Cannot remove $PKG!" - ;; - *) - error "usage: punani (install|remove) PACKAGE..." - return 23 - esac + PACKER_DB=$(printf ${PACKER}| sed 's/-//g') + for p in apt-get pacman yum brew;do + exists "$p" && PACKER=`printf $p | sed 's/-//g'` && break + done + + [ -z "${PACKER:-}" ] && error "Error 2: no known package manager found; no punani for you!" && return 1 + info "using $PACKER for install" + [ -z "$PKGS" ] && error "no PACKAGE specified." && ACTION="usage" + + + for PKG in $PKGS; do + RES="`_punani_resolve_package $PKG`" + test -z "$RES" && error "could not resolve '$PKG'; no punani for you!"&& return 23 + case "$ACTION" in + install) + eval _punani_${PACKER}_has $RES && info "$RES already installed, skipping" && continue + eval _punani_${PACKER}_install $RES || error "cannot install $RES with $PACKER" + ;; + remove) + ! eval _punani_${PACKER}_has $RES && info "$RES not installed, skipping" && continue + eval _punani_${PACKER}_remove $RES || error "cannot install $RES with $PACKER" + ;; + has) + if eval _punani_${PACKER}_has $RES ;then + info "$RES is installed" + else + info "$RES is not installed" + fi + ;; + *) + error "usage: punani (install|remove|has) PACKAGE..." + return 23 + esac + done } -- cgit v1.2.3 From a1fc5b132349946dc9dc536de7a2f2812e407105 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 2 Nov 2013 02:06:53 +0100 Subject: require root for punani only when you actually do something --- lib/punani | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/punani b/lib/punani index 41c59a46..d0a16c51 100644 --- a/lib/punani +++ b/lib/punani @@ -48,7 +48,7 @@ _punanidb_aptget_vim=vim _punani_resolve_package(){ : ${PACKER?PACKER is not set,bailing out} pkg=${1?please provide package name to resolve} - eval printf \"\${_punanidb_${PACKER_DB}_${pkg}-}\" | grep . + eval printf "%s" \"\${_punanidb_${PACKER}_${pkg}-}\" | grep . } _punani_aptget_install(){ apt-get -y install "$@" ;} _punani_aptget_remove(){ apt-get -y remove "$@" ;} @@ -64,12 +64,10 @@ _punani_brew_remove(){ brew remove "$@";} _punani_brew_has(){ error "not implemented"; return 1 ;} punani(){ - ! is_root && error "punani requires super-user rights" && return 1 ACTION="$1"; shift PKGS="$*" - PACKER_DB=$(printf ${PACKER}| sed 's/-//g') for p in apt-get pacman yum brew;do - exists "$p" && PACKER=`printf $p | sed 's/-//g'` && break + exists "$p" && PACKER=`printf "%s" "$p" | sed 's/-//g'` && break done [ -z "${PACKER:-}" ] && error "Error 2: no known package manager found; no punani for you!" && return 1 @@ -83,10 +81,12 @@ punani(){ case "$ACTION" in install) eval _punani_${PACKER}_has $RES && info "$RES already installed, skipping" && continue + ! is_root && error "punani requires super-user rights for installing" && return 1 eval _punani_${PACKER}_install $RES || error "cannot install $RES with $PACKER" ;; remove) ! eval _punani_${PACKER}_has $RES && info "$RES not installed, skipping" && continue + ! is_root && error "punani requires super-user rights for removing" && return 1 eval _punani_${PACKER}_remove $RES || error "cannot install $RES with $PACKER" ;; has) -- cgit v1.2.3 From 3060d3c4ce12fae2e8b754f13d0e227af2134ab5 Mon Sep 17 00:00:00 2001 From: makefu Date: Sat, 2 Nov 2013 02:43:11 +0100 Subject: add deploy script we are running hill billy style dependency resolution by cat-ing every lib into the resulting binary --- bin/punani | 4 ++++ deploy | 14 ++++++++++++++ lib/punani | 2 +- out/.placeholder | 0 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 bin/punani create mode 100755 deploy create mode 100644 out/.placeholder diff --git a/bin/punani b/bin/punani new file mode 100755 index 00000000..1e3fab87 --- /dev/null +++ b/bin/punani @@ -0,0 +1,4 @@ +#!/bin/sh +# include core +# include punani +punani "$@" diff --git a/deploy b/deploy new file mode 100755 index 00000000..5c282398 --- /dev/null +++ b/deploy @@ -0,0 +1,14 @@ +#!/bin/sh +set -x +cd $(dirname $0) +bindir=$PWD/bin/ +libdir=$PWD/lib/ +outdir=$PWD/out/ +# Hill-Billy style package builder +for file in `ls -1 $bindir`;do + # cat every lib and the file itself afterwards into outfile + find $libdir -type f -exec cat '{}' \; > $outdir/$file + cat $bindir/$file >> $outdir/$file + chmod 755 $outdir/$file +done + diff --git a/lib/punani b/lib/punani index d0a16c51..beaee27c 100644 --- a/lib/punani +++ b/lib/punani @@ -52,7 +52,7 @@ _punani_resolve_package(){ } _punani_aptget_install(){ apt-get -y install "$@" ;} _punani_aptget_remove(){ apt-get -y remove "$@" ;} -_punani_aptget_has() { dpkg -s "$1" >/dev/null 2>/dev/null ;} +_punani_aptget_has() { dpkg -s "$1" | grep -q "Status: install";} _punani_yum_install(){ yum -y install "$@" ;} _punani_yum_remove(){ yum -y remove "$@" ;} _punani_yum_has() { rpm -qa --qf "%{NAME}\n"| egrep "^${1}\$" >/dev/null ;} diff --git a/out/.placeholder b/out/.placeholder new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 6272109f2f4aa54f8971320ba822e2c58e3faf90 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 13:13:40 +0100 Subject: mobile.vvs.de: import from the past --- util/bin/mobile.vvs.de | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 util/bin/mobile.vvs.de diff --git a/util/bin/mobile.vvs.de b/util/bin/mobile.vvs.de new file mode 100755 index 00000000..b8777e02 --- /dev/null +++ b/util/bin/mobile.vvs.de @@ -0,0 +1,78 @@ +#! /bin/sh +set -euf + +ltrim() { + sed "s/^[${1-$symbols}]*//" +} + +POST() { + ## TODO url-encode, trim + tr '\n' '&' | sed 's/&$//' | + w3m -config /dev/null -cols 256 -post /dev/stdin -dump "${1-$URI}" +} + +limit=${limit-10} +origin="${1-$origin}" +H="${2-${H-`date +%H`}}" +M="${3-${M-`date +%M`}}" +Ymd="${4-${Ymd-`date +%Y%m%d`}}" + +URI='http://mobil.vvs.de/mobile/XSLT_DM_REQUEST' + +echo " +sessionID=0 +requestID=0 +language=de +locationServerActive=1 +useRealtime=1 +anySigWhenPerfectNoOtherMatches=1 +limit=$limit +deleteAssignedStops_dm=1 +mode=direct +convertCrossingsITKernel2LocationServer=1 +convertStopsPTKernel2LocationServer=1 +convertAddressesITKernel2LocationServer=1 +convertPOIsITKernel2LocationServer=1 +itdLPxx_dest= +useAllStops=1 +maxAssignedStops=1 +itOptionsActive=1 +trITMOTvalue100=5 +ptOptionsActive=1 +useProxFootSearch=0 +w_regPrefAm=1 +w_objPrefAl=2 +w_objPrefAl=12 +itdLPxx_script=true +place_dm= +placeState_dm=empty +nameState_dm=empty +nameInfo_dm=invalid +typeInfo_dm=invalid +placeInfo_dm=invalid +reducedAnyWithoutAddressObjFilter_dm=103 +reducedAnyPostcodeObjFilter_dm=64 +reducedAnyTooManyObjFilter_dm=2 +anyObjFilter_dm=126 +type_dm=any +name_dm=$origin +itdTimeHour=`echo $H | ltrim 0` +itdTimeMinute=`echo $M | ltrim 0` +itdDate=$Ymd +" | POST "$URI" | sed -rn ' + s/^Von:[^[:alpha:]]+(.*)$/'$H:$M' \1/p + /Haltestelle/,/^ *$/{ + /Haltestelle|^ *$/!{ + s/[[:space:]]*\[info\][[:space:]]*$// + p + } + } +' | { + read + echo "$REPLY" + while read time dev no dest ; do + printf "$time %3s → %s\n" $no "$dest" + done +} + +#### -- cgit v1.2.3 From 96cc79111cc32a2268c231475f9795e5dc452a91 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 13:20:18 +0100 Subject: vvs.de: import from the past --- util/bin/vvs.de | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 util/bin/vvs.de diff --git a/util/bin/vvs.de b/util/bin/vvs.de new file mode 100755 index 00000000..be9b9f14 --- /dev/null +++ b/util/bin/vvs.de @@ -0,0 +1,35 @@ +#! /bin/sh +set -euf + +#
+ #s/itdDateDay=/&${3-$itdDateDay}/ + #s/itdDateMonth=/&${4-$itdDateMonth}/ + #s/itdDateYear=/&${5-$itdDateYear}/ + +vvs_tmp=/tmp/vvs.tmp +curl -Ss http://www.vvs.de/fahrplan/ | +sed -rn "//,//{ + s.*.*\1=\2;T + /itdTripDateTimeDepArr=arr/b + s/(name_origin=).*/\1${1-$name_origin}/ + s/(name_destination=).*/\1${2-$name_destination}/ + ${3+s/(itdTimeHour=).*/\1${3-$itdTimeHour}/} + ${4+s/(itdTimeMinute=).*/\1${4-$itdTimeMinute}/} + p +}" | tr '\n' '&' | sed 's/&$//' >"$vvs_tmp" + + +#while read line ; do +# test -z "$line" || echo "$line" +#done >"$vvs_tmp" + +echo from: ${1-$name_origin} +echo \ \ to: ${2-$name_destination} +echo '-------------------------------------' +w3m -cols 9423 -post "$vvs_tmp" \ + -dump http://www.vvs.de/./efaanyfield/anyfield.php | +sed -rn " + s/^ +[0-9]+ +([0-9]+:[0-9]+) +([0-9]+:[0-9]+) +([A-Z0-9 ,]+) .*$/\1 \2 \3/p +" | tr -d , + +#### -- cgit v1.2.3 From acfa69aed25dcf27fae1550bb9c510f88c8cdd98 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 14:53:41 +0100 Subject: *vvs.de: add some basic documentation --- util/bin/mobile.vvs.de | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ util/bin/vvs.de | 26 +++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/util/bin/mobile.vvs.de b/util/bin/mobile.vvs.de index b8777e02..4d50745f 100755 --- a/util/bin/mobile.vvs.de +++ b/util/bin/mobile.vvs.de @@ -1,4 +1,93 @@ #! /bin/sh +# +# NAME +# mobile.vvs.de - web scraper for VVS departure information +# +# SYNOPSIS +# mobile.vvs.de ORIGIN [HH [MM [YYmmdd]]] +# +# DESCRIPTION +# The mobile.vvs.de utility fetches departure information from the +# Internet and prints the results to standard output. +# +# OPERANDS +# ORIGIN The point of departure. +# +# HH, MM, YYmmdd +# The time and date of departure. Defaults to the current +# time and date. +# +# STDIN +# Not used. +# +# INPUT FILES +# None. +# +# ENVIRONMENT VARIABLES +# The following environment variables affect the execution of mobile.vvs.de: +# +# limit Limits the number of entries to be fetched. +# +# origin, H, M, Ymd +# Provide defaults operands. If origin is set, then ORIGIN +# becomes optional. The order of the operands doesn't change +# by these variables. These variables are overridden by the +# operands. +# +# ASYNCHRONOUS EVENTS +# Defaults. +# +# STDOUT +# The first line has the format: +# +# "\e[4m%s:%s %s\e[m\n", H, M, origin_real_name +# +# where H and M are the corresponding provided or default operands. +# origin_real_name is the real name of the point of departure. +# +# The subsequent lines specify the departing means of transport. +# Each line has the format: +# +# "%s %s → %s\n", time_of_departure, line_number, destination +# +# where time_of_departure is self-evident, and line_number and +# destination identify the route and direction. +# +# STDERR +# Not used. +# +# OUTPUT FILES +# None. +# +# EXTENDED DESCRIPTION +# None. +# +# EXIT STATUS +# 0 A departure board could be fetched. +# +# 1 ORIGIN doesn't specify an acceptable point of departure. +# +# EXAMPLES +# 1. Get the top three current departures at Stuttgart, Hauptbahnhof: +# +# $ limit=3 mobile.vvs.de hauptbahnhof +# +# FUTURE DIRECTIONS +# None. +# +# BUGS +# The format of STDOUT suffers from bit rot. +# +# SEE ALSO +# vvs.de +# +# COPYRIGHT +# All departure information is copyrighted by Verkehrs- und +# Tarifverbund Stuttgart GmbH. The original copyright statement can +# be obtained online at http://www.vvs.de/impressum . +# +# The following code is your fault. +# set -euf ltrim() { diff --git a/util/bin/vvs.de b/util/bin/vvs.de index be9b9f14..718f34ce 100755 --- a/util/bin/vvs.de +++ b/util/bin/vvs.de @@ -1,4 +1,30 @@ #! /bin/sh +# +# NAME +# vvs.de - web scraper for VVS departure information +# +# SYNOPSIS +# vvs.de ORIGIN DESTINATION +# +# EXAMPLES +# $ vvs.de Hauptbahnhof Renningen +# +# CAVEATS +# Acceptable operands have to be found by trial and error. +# +# BUGS +# Probably bit rot.^_^ +# +# SEE ALSO +# mobile.vvs.de +# +# COPYRIGHT +# All departure information is copyrighted by Verkehrs- und +# Tarifverbund Stuttgart GmbH. The original copyright statement can +# be obtained online at http://www.vvs.de/impressum . +# +# The following code is your fault. +# set -euf # -- cgit v1.2.3 From 00c66a3beed0740408fb5796cfff3f68941e553e Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 15:11:18 +0100 Subject: add mobile.vvs.de smoke test --- util/t/mobile.vvs.de/smoke-test | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 util/t/mobile.vvs.de/smoke-test diff --git a/util/t/mobile.vvs.de/smoke-test b/util/t/mobile.vvs.de/smoke-test new file mode 100755 index 00000000..0b9e7960 --- /dev/null +++ b/util/t/mobile.vvs.de/smoke-test @@ -0,0 +1,5 @@ +#! /bin/sh +set -euf +mobile.vvs.de hauptbahnhof | + sed -n 'p;q' | + grep -q '\[4m[0-9][0-9]:[0-9][0-9] Stuttgart, Hauptbahnhof\[m' -- cgit v1.2.3 From c8e404282348d02d727bc70f58b3b005a0a9d869 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 15:31:15 +0100 Subject: make-realwallpaper: don't die @!needs_rebuild --- util/bin/make-realwallpaper | 83 ++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index 14f6b052..f8081337 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -40,24 +40,26 @@ main() { ; do normal=${raw%-raw.*}.png - needs_rebuild $normal $raw || continue - echo "make $normal; normalize $raw" >&2 - convert $raw -scale $in_size $normal + if needs_rebuild $normal $raw; then + echo "make $normal; normalize $raw" >&2 + convert $raw -scale $in_size $normal + fi done # create nightmap-fullsnow - needs_rebuild nightmap-fullsnow.png \ - && convert -size $in_size xc:$nightsnow_color nightmap-fullsnow.png + if needs_rebuild nightmap-fullsnow.png; then + convert -size $in_size xc:$nightsnow_color nightmap-fullsnow.png + fi # extract daymap-snowmask from daymap-final - needs_rebuild daymap-snowmask.png \ - daymap.png \ - && convert daymap.png -threshold 95% daymap-snowmask.png + if needs_rebuild daymap-snowmask.png daymap.png; then + convert daymap.png -threshold 95% daymap-snowmask.png + fi # extract nightmap-lightmask from nightmap - needs_rebuild nightmap-lightmask.png \ - nightmap.png \ - && convert nightmap.png -threshold 25% nightmap-lightmask.png + if needs_rebuild nightmap-lightmask.png nightmap.png; then + convert nightmap.png -threshold 25% nightmap-lightmask.png + fi # create layers make_layer nightmap-snowlayer.png nightmap-fullsnow.png daymap-snowmask.png @@ -114,17 +116,19 @@ satellite_file=$satellite_file shade=15 EOF - needs_rebuild krebs.sat \ - && cat >krebs.sat <krebs.sat <krebs.mar <krebs.mar <&2 - convert gcloud-raw.png -scale $gcloud_in_size gcloud-normal.png + if needs_rebuild gcloud-normal.png gcloud-raw.png; then + echo "make gcloud-normal.png; normalize gcloud-raw.png" >&2 + convert gcloud-raw.png -scale $gcloud_in_size gcloud-normal.png + fi - needs_rebuild gcloud-cloudmask.png gcloud-normal.png && - echo 'make gcloud-cloudmask.png' && - convert -flatten gcloud-normal.png \ - -fx 'p{i,(asinh(tan((j/h+0.5)*pi))/2.6+0.5)*h}' \ - -crop $gcloud_out_geometry \ - gcloud-cloudmask.png + if needs_rebuild gcloud-cloudmask.png gcloud-normal.png; then + echo 'make gcloud-cloudmask.png' && + convert -flatten gcloud-normal.png \ + -fx 'p{i,(asinh(tan((j/h+0.5)*pi))/2.6+0.5)*h}' \ + -crop $gcloud_out_geometry \ + gcloud-cloudmask.png + fi - needs_rebuild gcloud-fullcloud.png && - echo 'make gcloud-fullcloud.png' && - convert -size $gcloud_out_size xc:$gcloud_base_color gcloud-fullcloud.png + if needs_rebuild gcloud-fullcloud.png; then + echo 'make gcloud-fullcloud.png' && + convert -size $gcloud_out_size xc:$gcloud_base_color gcloud-fullcloud.png + fi } # usage: getimg FILENAME URL @@ -240,5 +248,4 @@ needs_rebuild() { return $result } - main "$@" -- cgit v1.2.3 From ddecabf669c09f85ad522d2f530d086922de1cf7 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 15:55:30 +0100 Subject: add vvs.de smoke test --- util/t/vvs.de/smoke-test | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 util/t/vvs.de/smoke-test diff --git a/util/t/vvs.de/smoke-test b/util/t/vvs.de/smoke-test new file mode 100755 index 00000000..451270fe --- /dev/null +++ b/util/t/vvs.de/smoke-test @@ -0,0 +1,11 @@ +#! /bin/sh +set -euf + +vvs.de Hauptbahnhof Renningen 13 37 | { + read from && test "x$from" = 'xfrom: Hauptbahnhof' + read to && test "x$to" = 'xto: Renningen' + read sep && test "x$sep" = 'x-------------------------------------' + while read line; do + echo "$line" | grep -q '^[0-9][0-9]:[0-9][0-9] [0-9][0-9]:[0-9][0-9] ' + done +} -- cgit v1.2.3 From 946e5f5256d800ae2a3dbbdc42ad6e62e37d1f50 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 16:15:20 +0100 Subject: tell travis about w3m --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e62f843f..92c5af77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq + - sudo apt-get install w3m -qq branches: only: - master -- cgit v1.2.3 From fc7f1e1fd601d11dfef53bc0dd890bbd6f596f6c Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 2 Nov 2013 16:24:17 +0100 Subject: make-realwallpaper gcloud now 4x faster --- util/bin/make-realwallpaper | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/util/bin/make-realwallpaper b/util/bin/make-realwallpaper index f8081337..ba2c6853 100755 --- a/util/bin/make-realwallpaper +++ b/util/bin/make-realwallpaper @@ -173,13 +173,20 @@ make_gcloud_cloudmask() { if needs_rebuild gcloud-normal.png gcloud-raw.png; then echo "make gcloud-normal.png; normalize gcloud-raw.png" >&2 - convert gcloud-raw.png -scale $gcloud_in_size gcloud-normal.png + convert -flatten gcloud-raw.png \ + -scale $gcloud_in_size gcloud-normal.png + fi + + if needs_rebuild gcloud-distmap.png; then + convert -size 2048x2048 gradient: -rotate 180 \ + -fx "p{i, (asinh(tan((j/h+0.5)*pi))/2.6+0.5) * h }" \ + gcloud-distmap.png fi if needs_rebuild gcloud-cloudmask.png gcloud-normal.png; then echo 'make gcloud-cloudmask.png' && - convert -flatten gcloud-normal.png \ - -fx 'p{i,(asinh(tan((j/h+0.5)*pi))/2.6+0.5)*h}' \ + convert gcloud-normal.png gcloud-distmap \ + -fx 'p{i,v*h}' \ -crop $gcloud_out_geometry \ gcloud-cloudmask.png fi -- cgit v1.2.3 From 8a1ecacac2f3f9475fbde6e165e27bf6e2aca583 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Nov 2013 16:50:16 +0100 Subject: mobile.vvs.de: posix me harder --- util/bin/mobile.vvs.de | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/bin/mobile.vvs.de b/util/bin/mobile.vvs.de index 4d50745f..fdc4cca2 100755 --- a/util/bin/mobile.vvs.de +++ b/util/bin/mobile.vvs.de @@ -157,7 +157,7 @@ itdDate=$Ymd } } ' | { - read + read REPLY echo "$REPLY" while read time dev no dest ; do printf "$time %3s → %s\n" $no "$dest" -- cgit v1.2.3 From dac51f386cbee53fbf674a16b612014b60efbee6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 16:23:49 +0100 Subject: cholerab: refine brick installation --- cholerab/tahoe/brick_installation | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/cholerab/tahoe/brick_installation b/cholerab/tahoe/brick_installation index b319393b..00eb6bfe 100644 --- a/cholerab/tahoe/brick_installation +++ b/cholerab/tahoe/brick_installation @@ -1,18 +1,42 @@ -#?/bin/sh -# Tahoe installation +#? /bin/sh + +## Tahoe Brick Installation (Arch Linux) pacman -S python2 python2-pip net-tools pip2 install pyasn1 zfec pycrypto zbase32 pycryptopp twisted pip2 install allmydata-tahoe -# tahoe configuration +## Tahoe Brick Installation (Arch Linux / Expert Mode^_^) +# if the above breaks for some reasont, but you basically know what you're +# doing, then you could try something like this: +pip2 uninstall `pip2 list | awk '{print$1}'` +yaourt -S --asdeps --noconfirm net-tools python2 python2-zope-interface \ + twisted python2-pyasn1 python2-crypto pycryptopp nevow python2-foolscap \ + python2-simplejson zfec python2-pyopenssl pyutil python2-argparse zbase32 \ + python2-mock python2-setuptools +yaourt -S --noconfirm tahoe-lafs + +## Tahoe Brick Configuration mkdir /opt/tahoe tahoe create-node /opt/tahoe useradd tahoe -d /opt/tahoe +chown -R tahoe: /opt/tahoe + # change nick name +(echo -n "nick name [$HOSTNAME]: " && + read name && + { test "x$name" != x || name=$HOSTNAME; } && + sed -i "s/^nickname =.*/nickname = $name/" /opt/tahoe/tahoe.cfg) + # replace introducer.furl = None with the one from pigstarter/tahoe/introducer.furl sed -i "s#^introducer\.furl.*#introducer.furl = $(curl pigstarter/tahoe/introducer.furl)#" /opt/tahoe/tahoe.cfg + # you also might want to change shares.needed to 2 , shares.happy to 3 and shares.total to 6 -# +sed -i 's/#shares\.needed = 3/shares.needed = 2/' /opt/tahoe/tahoe.cfg +sed -i 's/#shares\.happy = 7/shares.happy = 3/' /opt/tahoe/tahoe.cfg +sed -i 's/#shares\.total = 10/shares.happy = 6/' /opt/tahoe/tahoe.cfg + # optionally symlink /opt/tahoe/storage to somewhere with a lot of storage cp tahoe.service /usr/lib/systemd/system/tahoe.service + systemctl enable tahoe.service +systemctl start tahoe.service -- cgit v1.2.3 From 93c3a2b9051a8b9f711168eaae4d464c7a6c832d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 16:25:17 +0100 Subject: cholerab: fix typo --- cholerab/tahoe/brick_installation | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cholerab/tahoe/brick_installation b/cholerab/tahoe/brick_installation index 00eb6bfe..1aedb52b 100644 --- a/cholerab/tahoe/brick_installation +++ b/cholerab/tahoe/brick_installation @@ -6,7 +6,7 @@ pip2 install pyasn1 zfec pycrypto zbase32 pycryptopp twisted pip2 install allmydata-tahoe ## Tahoe Brick Installation (Arch Linux / Expert Mode^_^) -# if the above breaks for some reasont, but you basically know what you're +# if the above breaks for some reason, but you basically know what you're # doing, then you could try something like this: pip2 uninstall `pip2 list | awk '{print$1}'` yaourt -S --asdeps --noconfirm net-tools python2 python2-zope-interface \ -- cgit v1.2.3 From 52dc574f7a526661661255fc6e65640802609808 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 16:37:40 +0100 Subject: cholerab brick installation: remove legacy code --- cholerab/tahoe/brick_installation | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cholerab/tahoe/brick_installation b/cholerab/tahoe/brick_installation index 1aedb52b..79748623 100644 --- a/cholerab/tahoe/brick_installation +++ b/cholerab/tahoe/brick_installation @@ -23,9 +23,8 @@ chown -R tahoe: /opt/tahoe # change nick name (echo -n "nick name [$HOSTNAME]: " && - read name && - { test "x$name" != x || name=$HOSTNAME; } && - sed -i "s/^nickname =.*/nickname = $name/" /opt/tahoe/tahoe.cfg) + read nn && + sed -i "s/^nickname =.*/nickname = ${nn:-$HOSTNAME}/" /opt/tahoe/tahoe.cfg) # replace introducer.furl = None with the one from pigstarter/tahoe/introducer.furl sed -i "s#^introducer\.furl.*#introducer.furl = $(curl pigstarter/tahoe/introducer.furl)#" /opt/tahoe/tahoe.cfg -- cgit v1.2.3 From 11d255a4b21cd90221cf1ed15a96d249cf72ef1d Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 4 Nov 2013 16:49:28 +0100 Subject: update flags for travis irc notifications --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e62f843f..c333578b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ language: c notifications: irc: "chat.freenode.net#krebs_incoming" - + on_success: change + on_failure: always script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq -- cgit v1.2.3 From 65e726e1afc216b3f9065ad0ca31c7eb6e64efbf Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 16:58:55 +0100 Subject: .travis.yml: add template --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 677024b2..9a3ffc7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ notifications: irc: "chat.freenode.net#krebs_incoming" on_success: change on_failure: always +template: + - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq -- cgit v1.2.3 From 3eda4c81946b00d86f34021343e991908c5b3db6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:00:15 +0100 Subject: .travis.yml: test template --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9a3ffc7c..f9c2ee21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ notifications: on_failure: always template: - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" -script: "! ( make -C util test | grep -q '^not ok' )" +script: "! ( make -C util test | grep -q '^not ok' ); exit 23" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq -- cgit v1.2.3 From fdaea59565ee49715c726a9c152e5b3f403bd714 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:04:02 +0100 Subject: revert --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9a3ffc7c..f9c2ee21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ notifications: on_failure: always template: - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" -script: "! ( make -C util test | grep -q '^not ok' )" +script: "! ( make -C util test | grep -q '^not ok' ); exit 23" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq -- cgit v1.2.3 From 01789814dcb8c0fdc256e1dc7975c0ab72e5c741 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:21:40 +0100 Subject: Revert ".travis.yml: add template" This reverts commit 65e726e1afc216b3f9065ad0ca31c7eb6e64efbf. Conflicts: .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f9c2ee21..9a3ffc7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ notifications: on_failure: always template: - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" -script: "! ( make -C util test | grep -q '^not ok' ); exit 23" +script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq -- cgit v1.2.3 From 33c0b35ddba14a6407cc393260d35d7e718d7e26 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:32:57 +0100 Subject: .travis.yml: template belongs to irc --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a3ffc7c..38a96393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: c notifications: - irc: "chat.freenode.net#krebs_incoming" - on_success: change - on_failure: always -template: - - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" + irc: "chat.freenode.net#krebs_incoming" + on_success: change + on_failure: always + template: + - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq -- cgit v1.2.3 From c7e953623c6453bf5a66c7fe30fbf41af9d021d6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:34:29 +0100 Subject: .travis.yml: test template part #2 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 38a96393..60c677ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ notifications: on_failure: always template: - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" -script: "! ( make -C util test | grep -q '^not ok' )" +script: "! ( make -C util test | grep -q '^not ok' ); exit 23" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq -- cgit v1.2.3 From 0c87b4279fdc49052a66bcd174c2fc2e1a9cf0e8 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 17:36:32 +0100 Subject: Revert ".travis.yml: template belongs to irc" This reverts commit 33c0b35ddba14a6407cc393260d35d7e718d7e26. Conflicts: .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 60c677ca..38a96393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ notifications: on_failure: always template: - "painload/%{branch} %{commit} %{author}: %{message} %{build_url}" -script: "! ( make -C util test | grep -q '^not ok' ); exit 23" +script: "! ( make -C util test | grep -q '^not ok' )" before_install: - sudo apt-get install bc -qq - sudo apt-get install python -qq -- cgit v1.2.3 From 770f0329cd762cbba6b3b24fc37829e9768c6f1f Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 18:11:50 +0100 Subject: vvs.de: talk about hours and minutes --- util/bin/vvs.de | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/bin/vvs.de b/util/bin/vvs.de index 718f34ce..3b7ccf93 100755 --- a/util/bin/vvs.de +++ b/util/bin/vvs.de @@ -4,10 +4,10 @@ # vvs.de - web scraper for VVS departure information # # SYNOPSIS -# vvs.de ORIGIN DESTINATION +# vvs.de ORIGIN DESTINATION [HH [MM]] # # EXAMPLES -# $ vvs.de Hauptbahnhof Renningen +# $ vvs.de Hauptbahnhof Renningen 13 37 # # CAVEATS # Acceptable operands have to be found by trial and error. -- cgit v1.2.3 From 6b2f92901c7cf6edf3d335246d217aea0ccd28d8 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 18:13:00 +0100 Subject: services: disable pseudo-tty allocation --- services/bin/services | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/bin/services b/services/bin/services index 31aca200..aa65e81e 100755 --- a/services/bin/services +++ b/services/bin/services @@ -26,7 +26,7 @@ fi exec 3>&1 { set +e - ssh $options $user@$hostname -p $port + ssh -T $options $user@$hostname -p $port echo "# Exit:$?" >&2 } 2>&1 1>&3 | { err="`cat`" -- cgit v1.2.3 From a37acbec9fc339558403505adc9e809485227c5e Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 18:14:41 +0100 Subject: mtgox.ticker: update URI --- gold/mtgox/mtgox.ticker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gold/mtgox/mtgox.ticker b/gold/mtgox/mtgox.ticker index 32ee53bf..208d2764 100755 --- a/gold/mtgox/mtgox.ticker +++ b/gold/mtgox/mtgox.ticker @@ -19,7 +19,7 @@ fi # 2012-11-17 tv /krebs/gold/mtgox/mtgox.ticker ticker() { - curl -ksS https://mtgox.com/code/data/ticker.php?Currency=$Currency + curl -ksS https://data.mtgox.com/code/data/ticker.php?Currency=$Currency } # 2012-11-17 tv ~mw*@iiso:Espresso-phonegap/package/bin/json-print print() { -- cgit v1.2.3 From f4ee5e89dee44276592829ee9cfeb09f4b9dcfd6 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 18:15:49 +0100 Subject: soapi: use python2 --- ext/ovh/soapi/zoneExport | 2 +- ext/ovh/soapi/zoneImport | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/ovh/soapi/zoneExport b/ext/ovh/soapi/zoneExport index 8471f69c..3f6bdac7 100755 --- a/ext/ovh/soapi/zoneExport +++ b/ext/ovh/soapi/zoneExport @@ -1,4 +1,4 @@ -#!/usr/bin/python +#! /usr/bin/python2 from os import environ from os.path import dirname, realpath diff --git a/ext/ovh/soapi/zoneImport b/ext/ovh/soapi/zoneImport index 531fb8a1..c28710d6 100755 --- a/ext/ovh/soapi/zoneImport +++ b/ext/ovh/soapi/zoneImport @@ -1,4 +1,4 @@ -#!/usr/bin/python +#! /usr/bin/python2 from os import environ from os.path import dirname, realpath -- cgit v1.2.3 From 792f285cbc671e79f3e2d7d394c5d7fdf2b78b46 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 4 Nov 2013 23:44:47 +0100 Subject: cholerab brick installation: talk about port 46080 --- cholerab/tahoe/brick_installation | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cholerab/tahoe/brick_installation b/cholerab/tahoe/brick_installation index 79748623..72f9b106 100644 --- a/cholerab/tahoe/brick_installation +++ b/cholerab/tahoe/brick_installation @@ -39,3 +39,6 @@ cp tahoe.service /usr/lib/systemd/system/tahoe.service systemctl enable tahoe.service systemctl start tahoe.service + +## Firewall Configuration +# open port 46080 to allow inbound connections -- cgit v1.2.3 From 9cc8c71fd33b265c27d6112c996e3422943afce7 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Nov 2013 10:50:01 +0100 Subject: cholerab brick install.: talk about client.port --- cholerab/tahoe/brick_installation | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cholerab/tahoe/brick_installation b/cholerab/tahoe/brick_installation index 72f9b106..c8a10cd0 100644 --- a/cholerab/tahoe/brick_installation +++ b/cholerab/tahoe/brick_installation @@ -41,4 +41,4 @@ systemctl enable tahoe.service systemctl start tahoe.service ## Firewall Configuration -# open port 46080 to allow inbound connections +# open port $(cat /opt/tahoe/client.port) to allow inbound connections -- cgit v1.2.3 From d5dcf81c04353fad721a0d36d7fc14b50d47583a Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Nov 2013 12:35:25 +0100 Subject: cholerab thesauron: add KRI --- cholerab/thesauron | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cholerab/thesauron b/cholerab/thesauron index e9493fb5..36bea15c 100644 --- a/cholerab/thesauron +++ b/cholerab/thesauron @@ -21,6 +21,10 @@ krebs - krebs ist ein soziales Experiment, eine Organisation, das zweit aelteste Softwareprojekt im Shack und viel verteilte infrastruktur. +KRI abbr. (pronounciation: [en] cry) +[en] +- Short for Krebs Request for Implementation. + Derived from Scheme Requests for Implementation (SRFI). litterate programming n. [en] -- cgit v1.2.3 From 9d8fe306d3fc0618f7fca4afaae6306253c39e83 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Nov 2013 12:49:25 +0100 Subject: //shell: RIP --- .graveyard/shell/etc/ipt/ipv4-shield-1.rules | 10 ++++++++++ shell/etc/ipt/ipv4-shield-1.rules | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 .graveyard/shell/etc/ipt/ipv4-shield-1.rules delete mode 100644 shell/etc/ipt/ipv4-shield-1.rules diff --git a/.graveyard/shell/etc/ipt/ipv4-shield-1.rules b/.graveyard/shell/etc/ipt/ipv4-shield-1.rules new file mode 100644 index 00000000..c879311d --- /dev/null +++ b/.graveyard/shell/etc/ipt/ipv4-shield-1.rules @@ -0,0 +1,10 @@ +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] + +-AINPUT -m state --state RELATED,ESTABLISHED -jACCEPT + +-AINPUT -i lo -jACCEPT + +COMMIT diff --git a/shell/etc/ipt/ipv4-shield-1.rules b/shell/etc/ipt/ipv4-shield-1.rules deleted file mode 100644 index c879311d..00000000 --- a/shell/etc/ipt/ipv4-shield-1.rules +++ /dev/null @@ -1,10 +0,0 @@ -*filter -:INPUT DROP [0:0] -:FORWARD DROP [0:0] -:OUTPUT ACCEPT [0:0] - --AINPUT -m state --state RELATED,ESTABLISHED -jACCEPT - --AINPUT -i lo -jACCEPT - -COMMIT -- cgit v1.2.3 From bf87133ae8e2ce6eb7923dc22c29b8f162c8756a Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Nov 2013 12:53:34 +0100 Subject: ship README: add title --- ship/README | 1 + 1 file changed, 1 insertion(+) create mode 100644 ship/README diff --git a/ship/README b/ship/README new file mode 100644 index 00000000..b824b503 --- /dev/null +++ b/ship/README @@ -0,0 +1 @@ +# ship - shellscript installation processor -- cgit v1.2.3 From ae627d2aa73ea6862af3985f1c07e95c6d493275 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 5 Nov 2013 13:07:46 +0100 Subject: //punani: RIP --- .graveyard/punani/Makefile | 9 +++ .graveyard/punani/README.md | 30 +++++++++ .graveyard/punani/autostart/punani-debian | 102 +++++++++++++++++++++++++++++ .graveyard/punani/bin/punani | 70 ++++++++++++++++++++ .graveyard/punani/bot/__init__.py | 105 ++++++++++++++++++++++++++++++ .graveyard/punani/db/punani | 76 +++++++++++++++++++++ .graveyard/punani/doc/releases | 38 +++++++++++ .graveyard/punani/host/dist/arch/getsize | 17 +++++ .graveyard/punani/index.py | 97 +++++++++++++++++++++++++++ punani/Makefile | 9 --- punani/README.md | 30 --------- punani/autostart/punani-debian | 102 ----------------------------- punani/bin/punani | 70 -------------------- punani/bot/__init__.py | 105 ------------------------------ punani/db/punani | 76 --------------------- punani/doc/releases | 38 ----------- punani/host/dist/arch/getsize | 17 ----- punani/index.py | 97 --------------------------- 18 files changed, 544 insertions(+), 544 deletions(-) create mode 100644 .graveyard/punani/Makefile create mode 100644 .graveyard/punani/README.md create mode 100755 .graveyard/punani/autostart/punani-debian create mode 100755 .graveyard/punani/bin/punani create mode 100755 .graveyard/punani/bot/__init__.py create mode 100644 .graveyard/punani/db/punani create mode 100644 .graveyard/punani/doc/releases create mode 100755 .graveyard/punani/host/dist/arch/getsize create mode 100755 .graveyard/punani/index.py delete mode 100644 punani/Makefile delete mode 100644 punani/README.md delete mode 100755 punani/autostart/punani-debian delete mode 100755 punani/bin/punani delete mode 100755 punani/bot/__init__.py delete mode 100644 punani/db/punani delete mode 100644 punani/doc/releases delete mode 100755 punani/host/dist/arch/getsize delete mode 100755 punani/index.py diff --git a/.graveyard/punani/Makefile b/.graveyard/punani/Makefile new file mode 100644 index 00000000..f444b1fc --- /dev/null +++ b/.graveyard/punani/Makefile @@ -0,0 +1,9 @@ + +install: ../bin/punani + +../bin/punani: + ln -snvf ../punani/bin/punani ../bin/punani +debian: + useradd punani||: + cp autostart/punani-debian /etc/init.d/punani + update-rc.d punani defaults diff --git a/.graveyard/punani/README.md b/.graveyard/punani/README.md new file mode 100644 index 00000000..1b70eab7 --- /dev/null +++ b/.graveyard/punani/README.md @@ -0,0 +1,30 @@ +Overview +======= +Punani is a meta packagemanager comprising a server which resolves package +requests and a client containing the logic to find the best suitable packer +on the host system. Packagenames in Punani are binaries in the PATH. All +library packages are named in the Principle of Least Surprise[1]. Different +package names can resolve into the same package. + +If you want to install the `hostname` tool, the query is + punani install hostname +on an archlinux this will result in the call : + pacman --noconfirm -Sy --needed inetutils + +[1] http://de.wikipedia.org/wiki/Principle_of_Least_Surprise + +Punani Client +============ +The punani client will determine which packer are available on the system +and then send a request to the punani server to find out how the given +package is called with the given packer. In addition to that, the client +will add flags to the packers call in order to install packages only when +needed and disable user interaction. + +Punani Server +============ + +The punani server is a web-service which resolves request in the following +manner: + localhost/$packer/$package +The result is the package-name with the given packer or 404 if not found. diff --git a/.graveyard/punani/autostart/punani-debian b/.graveyard/punani/autostart/punani-debian new file mode 100755 index 00000000..53db0336 --- /dev/null +++ b/.graveyard/punani/autostart/punani-debian @@ -0,0 +1,102 @@ +#!/bin/sh +# uses template from /etc/init.d/skeleton +### BEGIN INIT INFO +# Provides: punani +# Required-Start: +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: punani +# Description: starts punani daemon +# +### END INIT INFO + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +NAME=punani +USER=punani +DESC="$NAME daemon" +DAEMON=/usr/bin/python +DAEMON_DIR="/krebs/punani" +DAEMON_ARGS="${DAEMON_DIR}/index.py" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +[ -x "$DAEMON" ] || exit 0 +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +. /lib/init/vars.sh +. /lib/lsb/init-functions + +do_start() +{ + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon -b -d $DAEMON_DIR -c $USER --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon -b -d $DAEMON_DIR -c $USER --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 +} + +do_stop() +{ + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + rm -f $PIDFILE + return "$RETVAL" +} + +do_reload() { + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; +