From 6cac66363039097f0ee89db1f15e9c91ff698bab Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 21:28:50 +0200 Subject: //meta/bin/update: initial commit --- meta/bin/update | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 meta/bin/update (limited to 'meta') diff --git a/meta/bin/update b/meta/bin/update new file mode 100755 index 00000000..98a69257 --- /dev/null +++ b/meta/bin/update @@ -0,0 +1,12 @@ +#! /bin/sh +set -euf + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +set -x +cd $(dirname $(readlink -f $0))` +git pull -- cgit v1.2.3 From 27d6e714d7a9c5f36d36d113e80e5924758bd855 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 21:36:16 +0200 Subject: //meta/bin/update: sudo to correct user --- meta/bin/update | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'meta') diff --git a/meta/bin/update b/meta/bin/update index 98a69257..717b9e90 100755 --- a/meta/bin/update +++ b/meta/bin/update @@ -1,12 +1,15 @@ #! /bin/sh set -euf -if test "${nosudo-false}" != true -a `id -u` != 0; then +cd $(dirname $(readlink -f $0))/../.. +id=`ls -lnd . | awk '{print$3}'` + +echo "// is $PWD owned by $id" + +if test "${nosudo-false}" != true -a `id -u` != $id; then echo "we're going sudo..." >&2 - exec sudo "$0" "$@" + exec sudo -u "#$id" "$0" "$@" exit 23 # go to hell fi -set -x -cd $(dirname $(readlink -f $0))` git pull -- cgit v1.2.3 From af58ce04faac0e73806e7a5ad9a2ad5262b459dd Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 21:53:00 +0200 Subject: //meta/install: initial commit --- meta/install | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 meta/install (limited to 'meta') diff --git a/meta/install b/meta/install new file mode 100755 index 00000000..db4412fe --- /dev/null +++ b/meta/install @@ -0,0 +1,26 @@ +#! /bin/sh +set -euf + +cd $(dirname $(readlink -f $0)) + +id=`ls -lnd . | awk '{print$3}'` +update=$PWD/bin/update + +echo "#" +echo "# to install metastatic automatization facility do following:" +echo "#" +echo +echo " sudo ln -vsn $update /update" +echo +echo "#" + +if test -e /update; then + echo "# but beware: you already have an /update like this:" + ls -l /update +fi + +if test `id -u` != $id; then + echo "# and remember to allow yourself to sudo -u $id /update" +fi + +echo "#^D" -- cgit v1.2.3 From 3eacd8b8d5d0bde9ac4381ae1e92833aa10610a8 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 21:55:22 +0200 Subject: //meta/install: fuck sudo --- meta/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta') diff --git a/meta/install b/meta/install index db4412fe..6bb04fec 100755 --- a/meta/install +++ b/meta/install @@ -10,7 +10,7 @@ echo "#" echo "# to install metastatic automatization facility do following:" echo "#" echo -echo " sudo ln -vsn $update /update" +echo " ln -vsn $update /update" echo echo "#" -- cgit v1.2.3 From dafd45a75f6c433485d2ec0fd4b9539b89e59175 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 22:06:43 +0200 Subject: //meta/install: try to be more intelligent... untested^_^ --- meta/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'meta') diff --git a/meta/install b/meta/install index 6bb04fec..b74b7f02 100755 --- a/meta/install +++ b/meta/install @@ -3,7 +3,7 @@ set -euf cd $(dirname $(readlink -f $0)) -id=`ls -lnd . | awk '{print$3}'` +id=`ls -ld . | awk '{print$3}'` update=$PWD/bin/update echo "#" @@ -19,8 +19,9 @@ if test -e /update; then ls -l /update fi -if test `id -u` != $id; then +if test `id -un` != $id; then echo "# and remember to allow yourself to sudo -u $id /update" + echo "# i.e. add `id -un` ($id) NOPASSWD:/update" fi echo "#^D" -- cgit v1.2.3 From 223af4b243b749a490f0698938e6655dc7ba67a4 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 22:13:59 +0200 Subject: //meta/bin/update: print info only once --- meta/bin/update | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meta') diff --git a/meta/bin/update b/meta/bin/update index 717b9e90..9b2289ad 100755 --- a/meta/bin/update +++ b/meta/bin/update @@ -4,12 +4,12 @@ set -euf cd $(dirname $(readlink -f $0))/../.. id=`ls -lnd . | awk '{print$3}'` -echo "// is $PWD owned by $id" - if test "${nosudo-false}" != true -a `id -u` != $id; then echo "we're going sudo..." >&2 exec sudo -u "#$id" "$0" "$@" exit 23 # go to hell fi +echo "// is $PWD owned by $id" + git pull -- cgit v1.2.3 From b2d997b47e52145c5119a6d71d00364ec231f3cc Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 22:23:57 +0200 Subject: //meta/install: try do do it even better^_^ --- meta/install | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'meta') diff --git a/meta/install b/meta/install index b74b7f02..07096b34 100755 --- a/meta/install +++ b/meta/install @@ -12,16 +12,14 @@ echo "#" echo echo " ln -vsn $update /update" echo -echo "#" - if test -e /update; then echo "# but beware: you already have an /update like this:" ls -l /update fi - -if test `id -un` != $id; then - echo "# and remember to allow yourself to sudo -u $id /update" - echo "# i.e. add `id -un` ($id) NOPASSWD:/update" -fi - +echo "# then check if you can execute following with your current user:" +echo +echo " /update" +echo +echo "# if not then add that user to your sudoers... maybe something" +echo "# like this could work: `id -un` ALL=($id) NOPASSWD:/update" echo "#^D" -- cgit v1.2.3