diff --git a/rpm/Make-scripts-more-compatible-with-other-shells.patch b/rpm/Make-scripts-more-compatible-with-other-shells.patch new file mode 100644 index 0000000..0724541 --- /dev/null +++ b/rpm/Make-scripts-more-compatible-with-other-shells.patch @@ -0,0 +1,128 @@ +From dd2a3596ce73eb0b31cddc49a8c61f6e595eb992 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= +Date: Thu, 6 Aug 2020 11:43:34 +0300 +Subject: [PATCH] Make scripts more compatible with other shells +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Tomi Leppänen +--- + trojans/csd-post.sh | 4 ++-- + trojans/csd-wrapper.sh | 28 ++++++++++++++-------------- + trojans/hipreport.sh | 2 +- + 3 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/trojans/csd-post.sh b/trojans/csd-post.sh +index df3ea34d..057bd294 100755 +--- a/trojans/csd-post.sh ++++ b/trojans/csd-post.sh +@@ -61,8 +61,8 @@ TICKET= + STUB=0 + + while [ "$1" ]; do +- if [ "$1" == "-ticket" ]; then shift; TICKET=${1//\"/}; fi +- if [ "$1" == "-stub" ]; then shift; STUB=${1//\"/}; fi ++ if [ "$1" = "-ticket" ]; then shift; TICKET=$1; fi ++ if [ "$1" = "-stub" ]; then shift; STUB=$1; fi + shift + done + +diff --git a/trojans/csd-wrapper.sh b/trojans/csd-wrapper.sh +index 2c191397..62ea8a57 100755 +--- a/trojans/csd-wrapper.sh ++++ b/trojans/csd-wrapper.sh +@@ -30,18 +30,18 @@ CERTHASH= + LANGSELEN= + + while [ "$1" ]; do +- if [ "$1" == "-ticket" ]; then shift; TICKET=$1; fi +- if [ "$1" == "-stub" ]; then shift; STUB=$1; fi +- if [ "$1" == "-group" ]; then shift; GROUP=$1; fi +- if [ "$1" == "-certhash" ]; then shift; CERTHASH=$1; fi +- if [ "$1" == "-url" ]; then shift; URL=$(echo $1|tr -d '"'); fi # strip quotes +- if [ "$1" == "-langselen" ];then shift; LANGSELEN=$1; fi ++ if [ "$1" = "-ticket" ]; then shift; TICKET=$1; fi ++ if [ "$1" = "-stub" ]; then shift; STUB=$1; fi ++ if [ "$1" = "-group" ]; then shift; GROUP=$1; fi ++ if [ "$1" = "-certhash" ]; then shift; CERTHASH=$1; fi ++ if [ "$1" = "-url" ]; then shift; URL=$(echo $1|tr -d '"'); fi # strip quotes ++ if [ "$1" = "-langselen" ];then shift; LANGSELEN=$1; fi + shift + done + + ARCH=$(uname -m) + +-if [[ "$ARCH" == "x86_64" ]] ++if [ "$ARCH" = "x86_64" ] + then + ARCH="linux_x64" + else +@@ -50,7 +50,7 @@ fi + + # creating dirs + for dir in $HOSTSCAN_DIR $LIB_DIR $BIN_DIR ; do +- if [[ ! -f $dir ]] ++ if [ ! -f $dir ] + then + mkdir -p $dir + fi +@@ -64,7 +64,7 @@ export HOSTSCAN_DIR=$HOSTSCAN_DIR + while read HASHTYPE FILE EQU HASHVAL; do + FILE="${FILE%*)}" + FILE="${FILE#(}" +- if grep --extended-regexp --quiet --invert-match ".so|tables.dat" <<< "$FILE"; then ++ if echo "$FILE" | grep --extended-regexp --quiet --invert-match ".so|tables.dat"; then + PATHNAME="${BIN_DIR}/$FILE" + IS_BIN=yes + else +@@ -74,17 +74,17 @@ while read HASHTYPE FILE EQU HASHVAL; do + DOWNLOAD=yes + case $HASHTYPE in + MD5) +- if [ -r "$PATHNAME" ] && md5sum --status -c <<< "$HASHVAL $PATHNAME"; then ++ if [ -r "$PATHNAME" ] && echo "$HASHVAL $PATHNAME" | md5sum --status -c; then + DOWNLOAD=no + fi + ;; + SHA1) +- if [ -r "$PATHNAME" ] && sha1sum --status -c <<< "$HASHVAL $PATHNAME"; then ++ if [ -r "$PATHNAME" ] && echo "$HASHVAL $PATHNAME" | sha1sum --status -c; then + DOWNLOAD=no + fi + ;; + SHA256) +- if [ -r "$PATHNAME" ] && sha256sum --status -c <<< "$HASHVAL $PATHNAME"; then ++ if [ -r "$PATHNAME" ] && echo "$HASHVAL $PATHNAME" | sha256sum --status -c; then + DOWNLOAD=no + fi + ;; +@@ -99,10 +99,10 @@ while read HASHTYPE FILE EQU HASHVAL; do + curl $PINNEDPUBKEY "${URL}/sdesktop/hostscan/$ARCH/$FILE" -o "${TMPFILE}" + + # some files are in gz (don't understand logic here) +- if [[ ! -f "${TMPFILE}" || ! -s "${TMPFILE}" ]] ++ if [ ! -f "${TMPFILE}" ] || [ ! -s "${TMPFILE}" ] + then + # remove 0 size files +- if [[ ! -s ${TMPFILE} ]]; then ++ if [ ! -s ${TMPFILE} ]; then + rm ${TMPFILE} + fi + +diff --git a/trojans/hipreport.sh b/trojans/hipreport.sh +index 832aabc8..9a948abf 100755 +--- a/trojans/hipreport.sh ++++ b/trojans/hipreport.sh +@@ -29,7 +29,7 @@ while [ "$1" ]; do + shift + done + +-if [ -z "$COOKIE" -o -z "$IP" -o -z "$MD5" ]; then ++if [ -z "$COOKIE" ] || [ -z "$IP" ] || [ -z "$MD5" ]; then + echo "Parameters --cookie, --computer, --client-ip, and --md5 are required" >&2 + exit 1; + fi +-- +2.26.2 + diff --git a/rpm/openconnect.spec b/rpm/openconnect.spec index 7851de7..81ba220 100644 --- a/rpm/openconnect.spec +++ b/rpm/openconnect.spec @@ -4,10 +4,10 @@ Name: openconnect Summary: Open client for Cisco AnyConnect VPN Version: 8.02 Release: 1 -Group: Applications/Internet License: LGPLv2+ -URL: http://www.infradead.org/openconnect.html +URL: https://git.sailfishos.org/mer-core/openconnect/ Source0: ftp://ftp.infradead.org/pub/openconnect/openconnect-%{version}.tar.gz +Patch0: Make-scripts-more-compatible-with-other-shells.patch Requires: vpnc Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig