summaryrefslogtreecommitdiffstats
path: root/ship/src
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-11-19 08:35:51 +0100
committermakefu <github@syntax-fehler.de>2013-11-19 08:35:51 +0100
commit5788b95fe7834d3049df9de1009f3d8dbc34fea2 (patch)
tree76675a9579c7c5e269825bfa73d29fe5256b8afb /ship/src
parentc15a8d15e910a39a641b21df08e13325a0e29293 (diff)
parent6f956cfe65ee00871bc9be19b2acadabb6638a69 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'ship/src')
-rwxr-xr-xship/src/punani46
-rwxr-xr-xship/src/remaster_arch_iso6
-rwxr-xr-xship/src/retiolum26
3 files changed, 57 insertions, 21 deletions
diff --git a/ship/src/punani b/ship/src/punani
index ceabd667..2c956f02 100755
--- a/ship/src/punani
+++ b/ship/src/punani
@@ -1,4 +1,50 @@
#! /bin/sh
#@info
#@include punani
+punani(){
+ _punani_usage='punani {install,remove,has,owner} PACKAGE...'
+ _punani_select_packer || die 'no package manager found; no punani for you!'
+
+ ACTION="$1"; shift
+
+ if test $# = 0; then
+ error 'no PACKAGE specified.'
+ die "usage: $_punani_usage"
+ fi
+
+ for PKG; do
+ RES="`_punani_resolve_package $PKG`" ||
+ die "could not resolve '$PKG'; no punani for you!"
+
+ case "$ACTION" in
+ install)
+ if punani_has $RES; then
+ info "$RES already installed, skipping"
+ else
+ punani_install $RES || error "cannot install $RES with $PACKER"
+ fi
+ ;;
+ remove)
+ if ! punani_has $RES; then
+ info "$RES not installed, skipping"
+ else
+ punani_remove $RES || error "cannot install $RES with $PACKER"
+ fi
+ ;;
+ has)
+ if punani_has $RES; then
+ info "$RES is installed"
+ else
+ info "$RES is not installed"
+ fi
+ ;;
+ owner)
+ punani_owner $RES
+ ;;
+ *)
+ error "bad action: $ACTION"
+ die "usage: $_punani_usage"
+ esac
+ done
+}
punani "$@"
diff --git a/ship/src/remaster_arch_iso b/ship/src/remaster_arch_iso
index 046b005b..66d5bc05 100755
--- a/ship/src/remaster_arch_iso
+++ b/ship/src/remaster_arch_iso
@@ -13,7 +13,7 @@ rootdir=$bdir/root
outdir=$bdir/out
auto_url=euer.krebsco.de/autoinstall
info "bdir is at $bdir"
-[ ! -e "$isofile" ] && die "$isofile does not exist,bailing out"
+[ ! -e "$isofile" ] && die "$isofile does not exist."
esudo "$@"
@@ -27,9 +27,7 @@ info "mounting isofile ($isofile)"
if is_root;then
mount -t iso9660 -o loop,ro $isofile $isomnt
else
- error "we are not root enough to mount the iso. Bailing Out"
- exit 1
-
+ die 'we are not root enough to mount the iso.'
fi
defer "info 'unmounting $isomnt';umount $isomnt"
diff --git a/ship/src/retiolum b/ship/src/retiolum
index d6e0efdc..ede1fd6a 100755
--- a/ship/src/retiolum
+++ b/ship/src/retiolum
@@ -38,33 +38,28 @@ main(){
if [ $IP4 -eq 0 ]; then
RAND4=1
elif ! check_ip_valid4 $IP4; then
- echo 'ip4 is invalid'
- exit 1
+ die 'ip4 is invalid'
fi
if [ $IP6 -eq 0 ]; then
RAND6=1
elif ! check_ip_valid6 $IP6; then
- echo 'ip6 is invalid'
- exit 1
+ die 'ip6 is invalid'
fi
#check if everything is installed
if ! exists awk ; then
- echo "Please install awk"
- exit 1
+ die 'Please install awk'
fi
if ! http_head $SURL >/dev/null 2>/dev/null ;then
- echo "Cannot find supernode package, check if your internet is working"
- exit 1
+ die 'Cannot find supernode package, check if your internet is working'
fi
#check if everything is installed
if [ $OS = 'android' ]; then
if ! test -e /data/data/org.poirsouille.tinc_gui/files/tincd; then
- echo "Please install tinc-gui"
- exit 1
+ die 'Please install tinc-gui'
else
TINCBIN=/data/data/org.poirsouille.tinc_gui/files/tincd
DEV="/dev/tun"
@@ -75,8 +70,7 @@ main(){
fi
elif [ $OS = 'osx' ]; then
if ! exists tincd >/dev/null; then
- echo "Please install tinc"
- exit 1
+ die 'Please install tinc'
else
TINCBIN=tincd
DEV="/dev/net/tun"
@@ -85,8 +79,7 @@ main(){
fi
else
if ! exists tincd >/dev/null; then
- echo "Please install tinc"
- exit 1
+ die 'Please install tinc'
else
TINCBIN=tincd
DEV="/dev/net/tun"
@@ -99,8 +92,7 @@ main(){
#test if tinc directory already exists
if test -e $TINCDIR/$NETNAME; then
- echo "tinc config directory $TINCDIR/$NETNAME does already exist. (backup and) delete config directory and restart"
- exit 1
+ die "tinc config directory $TINCDIR/$NETNAME does already exist. (backup and) delete config directory and restart"
fi
#get tinc-hostfiles
@@ -243,7 +235,7 @@ host2subnet()
2) FULLSUBNET=$SUBNET4.0.0 ;;
1) FULLSUBNET=$SUBNET4.0 ;;
0) FULLSUBNET=$SUBNET4 ;;
- *) echo "cannot read subnet" && exit 1;;
+ *) die 'cannot read subnet';;
esac
}