linux - A little help for a script -
i have made script downloads libreoffice , upgrades on slackware linux. wanna simple correction; if package file fails download, want script return "script fail at..."
for example, if libreoffice-mozplug..etc fail script returns "failed @ upgradepkg --install-new libreoffice-mozplug..etc" how it?
this script (i know..it not best i'm working on it)
#!/bin/sh set -e version=4.3.1 lackversion=14.1 alias wget="wget -nc" #get! wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-$version-x86_64-1alien.txz.asc wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-$version-x86_64-1alien.txz wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-dict-it-$version-x86_64-1alien.txz.asc wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-dict-it-$version-x86_64-1alien.txz wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-l10n-it-$version-x86_64-1alien.txz.asc wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-l10n-it-$version-x86_64-1alien.txz wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-mozplugin-$version-x86_64-1alien.txz wget http://www.slackware.com/~alien/slackbuilds/libreoffice/pkg64/$lackversion/libreoffice-mozplugin-4.3.1-x86_64-1alien.txz.asc #funzione gpg funzion1() { arg1=$1 arg2=$2 gpg -v $1 } #check gpg signature in *.asc;do `funzion1 $i`;done if [ $? -eq 0 ] echo "all well" else echo "problem signature." fi #funzione upgrade funzion2() { arg1=$1 arg2=$2 upgradepkg --install-new $1 } #check upgrade in *.txz;do `funzion2 $i`;done if [ $? -eq 0 ] echo "all well" else echo "problem upgrade." fi
after download files, need following (your function doesn't enough bother defining it):
for in *.asc; if gpg -v "$i"; echo "$i ok" else echo "problem $i's signature" fi done
you want check return status of each call gpg
, not last one.
Comments
Post a Comment