From 5c88a34e9675285be5861ce1c5b27e6eb684d5f9 Mon Sep 17 00:00:00 2001 From: thomasba Date: Tue, 8 Nov 2016 19:24:17 +0100 Subject: [PATCH] Use https and a few other improvements --- PKGBUILD | 10 ++++++---- paste42.sh | 24 +++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index c25329a..c7e4dcc 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,17 +2,17 @@ # PKGBUILD for ArchLinux pkgname=paste42 -pkgver=20110621.1 +pkgver=20161108.1 pkgrel=1 pkgdesc="Utility to post text files to paste42.de using curl" arch=('i686' 'x86_64') -url="http://paste42.de/" +url="https://paste42.de/" license=('GPL') depends=('curl' 'bash') makedepends=('git') source=() -_gitroot="git://thomasba.de/paste42.git" +_gitroot="git://git.thomasba.de/paste42.git" _gitname="paste42" build() { @@ -28,6 +28,8 @@ build() { fi msg "GIT checkout done or server timeout" +} - install -D -m755 ${_gitname}.sh ${pkgdir}/usr/bin/${_gitname} || return 1 +package() { + install -D -m755 "${srcdir}/${_gitname}/${_gitname}.sh" "${pkgdir}/usr/bin/${_gitname}" || return 1 } diff --git a/paste42.sh b/paste42.sh index 1792bbd..3866f39 100755 --- a/paste42.sh +++ b/paste42.sh @@ -3,15 +3,13 @@ # paste42.sh [-s] [-t "filetype"] [-l] [-h] [-u] file # Variablen initialisieren & defaults setzen -VERSION="20110621.1" +VERSION="20161108.1" ATTR='' -OPTS="" -EXP='0' TYPE="text" TYPES="4cs 6502acme 6502kickass 6502tasm 68000devpac abap actionscript3 actionscript ada algol68 apache applescript apt_sources asm asp autoconf autohotkey autoit avisynth awk bascomavr bash basic4gl bf bibtex blitzbasic bnf boo caddcl cadlisp cfdg cfm chaiscript cil c_loadrunner clojure c_mac cmake cobol coffeescript c cpp cpp-qt csharp css cuesheet dcs delphi diff div dos dot d ecmascript eiffel email epc e erlang euphoria f1 falcon fo fortran freebasic fsharp gambas gdb genero genie gettext glsl gml gnuplot go groovy gwbasic haskell hicest hq9plus html4strict html5 icon idl ini inno intercal io java5 java javascript j jquery kixtart klonec klonecpp latex lb lisp llvm locobasic logtalk lolcode lotusformulas lotusscript lscript lsl2 lua m68k magiksf make mapbasic matlab mirc mmix modula2 modula3 mpasm mxml mysql newlisp nsis oberon2 objc objeck ocaml-brief ocaml oobas oracle11 oracle8 oxygene oz pascal pcre perl6 perl per pf php-brief php pic16 pike pixelbender pli plsql postgresql povray powerbuilder powershell proftpd progress prolog properties providex purebasic pycon python qbasic q rails rebol reg robots rpmspec rsplus ruby sas scala scheme scilab sdlbasic smalltalk smarty sql systemverilog tcl teraterm text thinbasic tsql typoscript unicon uscript vala vbnet vb verilog vhdl vim visualfoxpro visualprolog whitespace whois winbatch xbasic xml xorg_conf xpp yaml z80 zxbasic" pw=0 -trap 'stty echo;exit 1;' 3 9 15 +trap 'stty echo;exit 1;' 3 15 usage() { echo "Usage:" @@ -38,7 +36,7 @@ filetypes() { } checkUpdate() { - SERV_VER=$(curl -s -S 'http://git.thomasba.de/cgit/paste42/plain/paste42.sh' | sed -e '/^VERSION=.*/ !d;s/VERSION="\(.*\)"/\1/') + SERV_VER=$(curl -s -S 'https://git.thomasba.de/cgit/paste42/plain/paste42.sh' | sed -e '/^VERSION=.*/ !d;s/VERSION="\(.*\)"/\1/') if [ "$SERV_VER" != "$VERSION" ] ; then echo "Update available!" echo "Your version: $VERSION" @@ -61,10 +59,10 @@ while getopts pst:lhue: opt ; do l) filetypes;exit;; u) checkUpdate;exit;; p) pw=1;; - e) ATTR=$ATTR' -d exp='$(echo $OPTARG|sed -e 's/[^0-9:\.a-zA-Z ,]//g');; + e) ATTR=$ATTR' -d exp='"${OPTARG//[^0-9:\.a-zA-Z ,]/}";; esac done -shift $(expr $OPTIND - 1) +shift $((OPTIND - 1)) # wenn dateiname leer ist, beenden if [ -z "$1" ] ; then @@ -73,7 +71,7 @@ if [ -z "$1" ] ; then fi # wenn datei nicht existiert oder nicht lesbar ist, suizid -if [ ! -f "$1" -o ! -r "$1" ] ; then +if [ ! -f "$1" ] || [ ! -r "$1" ] ; then echo "File \"$1\" not readable!" >&2 exit 1 fi @@ -81,7 +79,7 @@ if [ ! -s "$1" ] ; then echo "File is empty!" >&2 exit 1 fi -if [ -b "$1" -o -c "$1" -o -S "$1" -o -d "$1" ] ; then +if [ -b "$1" ] || [ -c "$1" ] || [ -S "$1" ] || [ -d "$1" ] ; then echo "\"$1\" is no ordinary file!" exit 1 fi @@ -98,14 +96,14 @@ if [ $pw -eq 1 ] ; then while [ ! "$password" = "$password2" ] ; do if [ ! "$password" = "" ] ; then echo "The passwords didn't match." ; fi echo -ne " Password: " - stty -echo ; read password ; stty echo + stty -echo ; read -r password ; stty echo echo -ne "\n Repeat the password: " - stty -echo ; read password2 ; stty echo + stty -echo ; read -r password2 ; stty echo echo "" done fi -filename=`basename $1` +filename=$(basename "$1") # und die daten absenden. -curl -s -S --data-urlencode "del=$password" -d "title=curl paste of $filename" $ATTR -d "type=$TYPE" --data-urlencode "text@$1" 'http://paste42.de/save' +curl -s -S --data-urlencode "del=$password" -d "title=curl paste of $filename" $ATTR -d "type=$TYPE" --data-urlencode "text@$1" 'https://paste42.de/save'