From 2c6e3fddb3d0a3a95afd395c16f119def05e2a28 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 19 Dec 2008 12:28:37 +0100 Subject: forgot to update some time... --- gpg-agent.sh | 13 ++++++ ssh-mount.sh | 14 +++++-- ssh-unmount.sh | 2 + upgpkg | 59 +++++++++++++++++++++++++++ urlencode | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ xup.sh | 37 +++++++++++++++++ 6 files changed, 247 insertions(+), 3 deletions(-) create mode 100755 gpg-agent.sh create mode 100755 upgpkg create mode 100755 urlencode create mode 100755 xup.sh diff --git a/gpg-agent.sh b/gpg-agent.sh new file mode 100755 index 0000000..e82f5c0 --- /dev/null +++ b/gpg-agent.sh @@ -0,0 +1,13 @@ +#!/bin/sh +initgpg(){ + envfile="${HOME}/.gpginfo" + if test -f ${envfile} && kill -0 $(cut -d: -f 2 ${envfile} | head -n 1) 2>/dev/null; then + eval $(cat ${envfile}) + else + eval `/usr/bin/gpg-agent --daemon --enable-ssh-support --write-env-file ${envfile}` + fi + export GPG_AGENT_INFO + export SSH_AUTH_SOCK + export SSH_AGENT_PID +} +initgpg diff --git a/ssh-mount.sh b/ssh-mount.sh index 481d61c..c5765c8 100755 --- a/ssh-mount.sh +++ b/ssh-mount.sh @@ -3,13 +3,21 @@ if [ "$1" = "" ] || [ "$1" = "-h" ]; then echo -e "${blue}Usage:$NC mount-ftp "; - echo -e "${green}Servers:$NC ipx, wf"; + echo -e "${green}Servers:$NC wf, nevera-web, nevera-flo, df"; exit 1 else case $1 in - ipx) + nevera-flo) + sshfs flo@nevera: -o reconnect -p 22222 ${HOME}/workspace/ipx_flo_ssh && + echo -e "${GREEN}Nevera /home/flo mounted.$NC" + ;; + nevera-web) sshfs web0@nevera: -o reconnect -p 22222 ${HOME}/workspace/ipx_ssh && - echo -e "${GREEN}IPX mounted.$NC" + echo -e "${GREEN}Nevera web mounted.$NC" + ;; + df) + sshfs 105012-ftp@seitznet2.at: -o reconnect -p 22 ${HOME}/workspace/df_ssh && + echo -e "${GREEN}DF mounted.$NC" ;; wf) sshfs stem47@stem47.loomes.net: -o reconnect -p 22 ${HOME}/workspace/wf_ssh && diff --git a/ssh-unmount.sh b/ssh-unmount.sh index fca1868..41664ec 100755 --- a/ssh-unmount.sh +++ b/ssh-unmount.sh @@ -1,6 +1,8 @@ #!/bin/sh fusermount -uq ${HOME}/workspace/ipx_ssh +fusermount -uq ${HOME}/workspace/ipx_flo_ssh +fusermount -uq ${HOME}/workspace/df_ssh fusermount -uq ${HOME}/workspace/wf_ssh echo -e "${GREEN}Unmounted."; diff --git a/upgpkg b/upgpkg new file mode 100755 index 0000000..0a2b203 --- /dev/null +++ b/upgpkg @@ -0,0 +1,59 @@ +#!/bin/bash + +# upgpkg: Upgrades package versions in PKGBUILD and starts build. +# Author: Abhishek Dasgupta +# Thanks to cactus, profjim and daenyth for all the sed help! +# Requires: pkgtools. + +# I place this script in the public domain. + +MYVERSION=0.1 +PROGNAME="upgpkg" + +if [ -r /usr/share/pkgtools/functions ]; then + source /usr/share/pkgtools/functions +else + printf "$(gettext "upgpkg: Unable to source function file!\n")" >&2 + exit 1 +fi + +die() { + local message="$1" + shift + printf "$message" "$@" + exit 1 +} + +if [ -r /etc/pkgtools/newpkg.conf ]; then + source /etc/pkgtools/newpkg.conf +fi +if [ -r "${HOME}/.pkgtools/newpkg.conf" ]; then + source "${HOME}/.pkgtools/newpkg.conf" +fi + +if [ -z "$BASEDIR" ]; then die "$(gettext "upgpkg: unable to locate BASEDIR in configuration.")"; fi + +if [ -z "$1" ]; then printf "upgpkg %s\n" "$MYVERSION"; printf "$(gettext "usage: upgpkg package-name newver\n")"; exit; fi + +if [ ! -d "$BASEDIR/$1" ]; then die "$(gettext "upgpkg: package %s not in %s.\n")" "$1" "$BASEDIR"; fi +if [ -z "$2" ]; then die "$(gettext "upgpkg: no new version specified for %s\n")" "$1"; fi + +# Main code follows + +cd "$BASEDIR/$1" +sed -ri '/md5sums[ ]?\=/{:a; /\)/d; N; ba;}' PKGBUILD || die "upgpkg: could not bump pkgver of $1\n" +source PKGBUILD + +if [ $(vercmp $2 $pkgver) -gt 0 ]; then + sed -i "s/pkgver=.*$/pkgver=$2/g" PKGBUILD + sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD + makepkg -g >> PKGBUILD +else + die "$(gettext "upgpkg: %s - new version (%s) older or equal to current %s\n")" "$1" "$2" "$pkgver" +fi +makepkg -m +if [ $? -gt 0 ]; then + sed -i "s/pkgver=.*$/pkgver=$pkgver/g" PKGBUILD + sed -i "s/pkgrel=.*$/pkgrel=$pkgrel/g" PKGBUILD + die "$(gettext "upgpkg: %s - build failed for %s, reverting to %s\n")" "$1" "$2" "$pkgver" +fi diff --git a/urlencode b/urlencode new file mode 100755 index 0000000..c472ab8 --- /dev/null +++ b/urlencode @@ -0,0 +1,125 @@ +: +########################################################################## +# Title : urlencode - encode URL data +# Author : Heiner Steven (heiner.steven@odn.de) +# Date : 2000-03-15 +# Requires : awk +# Categories : File Conversion, WWW, CGI +# SCCS-Id. : @(#) urlencode 1.4 06/10/29 +########################################################################## +# Description +# Encode data according to +# RFC 1738: "Uniform Resource Locators (URL)" and +# RFC 1866: "Hypertext Markup Language - 2.0" (HTML) +# +# This encoding is used i.e. for the MIME type +# "application/x-www-form-urlencoded" +# +# Notes +# o The default behaviour is not to encode the line endings. This +# may not be what was intended, because the result will be +# multiple lines of output (which cannot be used in an URL or a +# HTTP "POST" request). If the desired output should be one +# line, use the "-l" option. +# +# o The "-l" option assumes, that the end-of-line is denoted by +# the character LF (ASCII 10). This is not true for Windows or +# Mac systems, where the end of a line is denoted by the two +# characters CR LF (ASCII 13 10). +# We use this for symmetry; data processed in the following way: +# cat | urlencode -l | urldecode -l +# should (and will) result in the original data +# +# o Large lines (or binary files) will break many AWK +# implementations. If you get the message +# awk: record `...' too long +# record number xxx +# consider using GNU AWK (gawk). +# +# o urlencode will always terminate it's output with an EOL +# character +# +# Thanks to Stefan Brozinski for pointing out a bug related to non-standard +# locales. +# +# See also +# urldecode +########################################################################## + +PN=`basename "$0"` # Program name +VER='1.4' + +: ${AWK=awk} + +Usage () { + echo >&2 "$PN - encode URL data, $VER +usage: $PN [-l] [file ...] + -l: encode line endings (result will be one line of output) + +The default is to encode each input line on its own." + exit 1 +} + +Msg () { + for MsgLine + do echo "$PN: $MsgLine" >&2 + done +} + +Fatal () { Msg "$@"; exit 1; } + +set -- `getopt hl "$@" 2>/dev/null` || Usage +[ $# -lt 1 ] && Usage # "getopt" detected an error + +EncodeEOL=no +while [ $# -gt 0 ] +do + case "$1" in + -l) EncodeEOL=yes;; + --) shift; break;; + -h) Usage;; + -*) Usage;; + *) break;; # First file name + esac + shift +done + +LANG=C export LANG +$AWK ' + BEGIN { + # We assume an awk implementation that is just plain dumb. + # We will convert an character to its ASCII value with the + # table ord[], and produce two-digit hexadecimal output + # without the printf("%02X") feature. + + EOL = "%0A" # "end of line" string (encoded) + split ("1 2 3 4 5 6 7 8 9 A B C D E F", hextab, " ") + hextab [0] = 0 + for ( i=1; i<=255; ++i ) ord [ sprintf ("%c", i) "" ] = i + 0 + if ("'"$EncodeEOL"'" == "yes") EncodeEOL = 1; else EncodeEOL = 0 + } + { + encoded = "" + for ( i=1; i<=length ($0); ++i ) { + c = substr ($0, i, 1) + if ( c ~ /[a-zA-Z0-9.-]/ ) { + encoded = encoded c # safe character + } else if ( c == " " ) { + encoded = encoded "+" # special handling + } else { + # unsafe character, encode it as a two-digit hex-number + lo = ord [c] % 16 + hi = int (ord [c] / 16); + encoded = encoded "%" hextab [hi] hextab [lo] + } + } + if ( EncodeEOL ) { + printf ("%s", encoded EOL) + } else { + print encoded + } + } + END { + #if ( EncodeEOL ) print "" + } +' "$@" diff --git a/xup.sh b/xup.sh new file mode 100755 index 0000000..bacd7a2 --- /dev/null +++ b/xup.sh @@ -0,0 +1,37 @@ +#!/bin/sh +#----------------------------------------------------# +# File: xup.sh +# Version: 0.1.1 +# Date: 2008-12-14 +# Author: Florian "Bluewind" Pritz +# Upload file to XUP, copy URL to clipboard and +# save to historyfile +#----------------------------------------------------# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +XUPHIST="${HOME}/.xup_history" +FILE=$(basename $1) +DIR=$(dirname $1) +cd $DIR + +URLS=$(curl -# -F "F1=@$FILE" -L "http://www.xup.in/xtrans.php" -H "Expect: ") +DL_URL=$(echo -n ${URLS} | ack -o "\"http://www.xup.in/dl,.{8}/$FILE/\"" | sed "s#\"##g") +DEL_URL=$(echo -n ${URLS} | ack -o "\"http://www.xup.in/kill,.{8},.{10}/\"" | sed "s#\"##g") + +echo $(date) >> $XUPHIST +echo "$PWD/$FILE" >> $XUPHIST +echo $DL_URL >> $XUPHIST +echo -n $DL_URL | xclip +echo $DEL_URL >> $XUPHIST +echo "" >> $XUPHIST -- cgit v1.2.3-24-g4f1b