projects
/
grml-network.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5d75540
)
Fix bashism/non-POSIX usage of $UID.
author
Michael Prokop
<mika@grml.org>
Wed, 28 Apr 2010 22:41:32 +0000
(
00:41
+0200)
committer
Michael Prokop
<mika@grml.org>
Wed, 28 Apr 2010 22:41:32 +0000
(
00:41
+0200)
sbin/grml-ap
patch
|
blob
|
history
sbin/grml-bridge
patch
|
blob
|
history
sbin/grml-network
patch
|
blob
|
history
sbin/grml-pptp-inode
patch
|
blob
|
history
sbin/grml-pptp-vcgraz
patch
|
blob
|
history
sbin/grml-pptp-xdsl-students
patch
|
blob
|
history
sbin/grml-router
patch
|
blob
|
history
sbin/grml-vnet
patch
|
blob
|
history
sbin/grml-vpnc-tugraz
patch
|
blob
|
history
sbin/modemlink
patch
|
blob
|
history
sbin/netcardconfig
patch
|
blob
|
history
diff --git
a/sbin/grml-ap
b/sbin/grml-ap
index
a6c4f62
..
1fc24b1
100755
(executable)
--- a/
sbin/grml-ap
+++ b/
sbin/grml-ap
@@
-14,7
+14,7
@@
CONFIG_FILE=/etc/grml/routersetup
. /etc/grml/net-functions
. /etc/grml/script-functions
. /etc/grml/net-functions
. /etc/grml/script-functions
-check4root
+check4root
|| exit 1
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
diff --git
a/sbin/grml-bridge
b/sbin/grml-bridge
index
9ee19ab
..
93e6686
100755
(executable)
--- a/
sbin/grml-bridge
+++ b/
sbin/grml-bridge
@@
-10,7
+10,7
@@
CONFIG_FILE=/etc/grml/routersetup
. /etc/grml/lsb-functions
. /etc/grml/script-functions
. /etc/grml/lsb-functions
. /etc/grml/script-functions
-check4root
+check4root
|| exit 1
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
diff --git
a/sbin/grml-network
b/sbin/grml-network
index
617c272
..
46393a6
100755
(executable)
--- a/
sbin/grml-network
+++ b/
sbin/grml-network
@@
-9,9
+9,8
@@
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin"
export PATH
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin"
export PATH
-if [ $UID != 0 ] ; then
- echo Error: become root before starting $0 >& 2
- exit 100
+if [ $(id -ru) -ne 0 ] ; then
+ echo 1>&2 "Error: please run this script with uid 0 (root)." ; exit 1
fi
# XDIALOG_HIGH_DIALOG_COMPAT=1
fi
# XDIALOG_HIGH_DIALOG_COMPAT=1
diff --git
a/sbin/grml-pptp-inode
b/sbin/grml-pptp-inode
index
3c61d33
..
abef059
100755
(executable)
--- a/
sbin/grml-pptp-inode
+++ b/
sbin/grml-pptp-inode
@@
-14,9
+14,8
@@
export LANG=C
export LANG=C
-if [ $UID != 0 ] ; then
- echo Error: become root before starting $0 >& 2
- exit 100
+if [ $(id -ru) -ne 0 ] ; then
+ echo 1>&2 "Error: please run this script with uid 0 (root)." ; exit 1
fi
if [ -z "$FORCE_OLD" ] ; then
fi
if [ -z "$FORCE_OLD" ] ; then
@@
-46,7
+45,7
@@
EOF
echo "${VPNUSERNAME} XDSL ${VPNPASSWORD} *" >> /etc/ppp/pap-secrets
chmod 0600 /etc/ppp/pap-secrets
echo "${VPNUSERNAME} XDSL ${VPNPASSWORD} *" >> /etc/ppp/pap-secrets
chmod 0600 /etc/ppp/pap-secrets
-
echo -e
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\n" > /etc/init.d/pptp
+
printf
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\n" > /etc/init.d/pptp
cat >> /etc/init.d/pptp << "EOF"
cat >> /etc/init.d/pptp << "EOF"
diff --git
a/sbin/grml-pptp-vcgraz
b/sbin/grml-pptp-vcgraz
index
fc2f6c7
..
b1fe498
100755
(executable)
--- a/
sbin/grml-pptp-vcgraz
+++ b/
sbin/grml-pptp-vcgraz
@@
-15,7
+15,7
@@
export LANG=C
export LC_ALL=C
export LANG=C
export LC_ALL=C
-if [
"$UID" != 0 ];
then
+if [
$(id -ru) -ne 0 ] ;
then
sudo $0
exit
fi
sudo $0
exit
fi
@@
-51,7
+51,7
@@
chmod 600 /etc/ppp/chap-secrets
# don't overwrite existing files - so just append:
echo "${VPNUSERNAME} PPTP ${VPNPASSWORD} *" >> /etc/ppp/chap-secrets
# don't overwrite existing files - so just append:
echo "${VPNUSERNAME} PPTP ${VPNPASSWORD} *" >> /etc/ppp/chap-secrets
-
echo -e
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\nDORMITORY=\"${DORMITORY}\"" > /etc/init.d/pptp-vcgraz
+
printf
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\nDORMITORY=\"${DORMITORY}\"" > /etc/init.d/pptp-vcgraz
cat >> /etc/init.d/pptp-vcgraz << "EOF"
# connect to vc-graz via pptp
case "$1" in
cat >> /etc/init.d/pptp-vcgraz << "EOF"
# connect to vc-graz via pptp
case "$1" in
diff --git
a/sbin/grml-pptp-xdsl-students
b/sbin/grml-pptp-xdsl-students
index
9a26a6b
..
e135528
100755
(executable)
--- a/
sbin/grml-pptp-xdsl-students
+++ b/
sbin/grml-pptp-xdsl-students
@@
-17,7
+17,7
@@
export LANG=C
DIALOG="dialog"
export LANG=C
DIALOG="dialog"
-if [
"$UID" != 0 ];
then
+if [
$(id -ru) -ne 0 ] ;
then
sudo $0
exit
fi
sudo $0
exit
fi
@@
-64,7
+64,7
@@
EOF
echo "${VPNUSERNAME} XDSL ${VPNPASSWORD} *" >> /etc/ppp/pap-secrets
chmod 0600 /etc/ppp/pap-secrets
echo "${VPNUSERNAME} XDSL ${VPNPASSWORD} *" >> /etc/ppp/pap-secrets
chmod 0600 /etc/ppp/pap-secrets
-
echo -e
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\n" > /etc/init.d/pptp
+
printf
"#!/bin/sh\nLANG=C\nVPNSERVER=\"${VPNSERVER}\"\n" > /etc/init.d/pptp
cat >> /etc/init.d/pptp << "EOF"
cat >> /etc/init.d/pptp << "EOF"
diff --git
a/sbin/grml-router
b/sbin/grml-router
index
219ae19
..
b959f12
100755
(executable)
--- a/
sbin/grml-router
+++ b/
sbin/grml-router
@@
-11,10
+11,7
@@
CONFIG_FILE=/etc/grml/routersetup
. /etc/grml/net-functions
. /etc/grml/script-functions
. /etc/grml/net-functions
. /etc/grml/script-functions
-if [ $UID != 0 ]; then
- eerror "Error: become root before starting $0"
- exit 100
-fi
+check4root || exit 1
if ! [ -r $CONFIG_FILE ] ; then
eerror "$CONFIG_FILE could not be read."
if ! [ -r $CONFIG_FILE ] ; then
eerror "$CONFIG_FILE could not be read."
diff --git
a/sbin/grml-vnet
b/sbin/grml-vnet
index
82aca72
..
7fa0d95
100755
(executable)
--- a/
sbin/grml-vnet
+++ b/
sbin/grml-vnet
@@
-16,6
+16,9
@@
OPT_GROUP_=''
OPT_BRIDGE_=''
OPT_AUTO_='false'
OPT_BRIDGE_=''
OPT_AUTO_='false'
+if [ $(id -ru) -ne 0 ] ; then
+ echo 1>&2 "Error: please run this script with uid 0 (root)." ; exit 1
+fi
function printUsage()
{
function printUsage()
{
diff --git
a/sbin/grml-vpnc-tugraz
b/sbin/grml-vpnc-tugraz
index
05fa947
..
0fc6bf3
100755
(executable)
--- a/
sbin/grml-vpnc-tugraz
+++ b/
sbin/grml-vpnc-tugraz
@@
-12,7
+12,7
@@
export LANG=C
export LC_ALL=C
export LANG=C
export LC_ALL=C
-if [
"$UID" != 0 ];
then
+if [
$(id -ru) -ne 0 ] ;
then
sudo $0
exit
fi
sudo $0
exit
fi
diff --git
a/sbin/modemlink
b/sbin/modemlink
index
6e4599c
..
fa9c3b1
100755
(executable)
--- a/
sbin/modemlink
+++ b/
sbin/modemlink
@@
-12,9
+12,8
@@
export PATH
# XDIALOG_HIGH_DIALOG_COMPAT=1
# export XDIALOG_HIGH_DIALOG_COMPAT
# XDIALOG_HIGH_DIALOG_COMPAT=1
# export XDIALOG_HIGH_DIALOG_COMPAT
-if [ $UID != 0 ] ; then
- echo Error: become root before starting $0 >& 2
- exit 100
+if [ "$(id -u 2>/dev/null)" != 0 ] ; then
+ echo 1>&2 "Error: please run this script with uid 0 (root)." ; exit 1
fi
TMP=$(mktemp)
fi
TMP=$(mktemp)
diff --git
a/sbin/netcardconfig
b/sbin/netcardconfig
index
03784a9
..
40252b7
100755
(executable)
--- a/
sbin/netcardconfig
+++ b/
sbin/netcardconfig
@@
-15,7
+15,7
@@
LANGUAGE=C LANG=C
export PATH LANGUAGE LANG
. /etc/grml/script-functions
export PATH LANGUAGE LANG
. /etc/grml/script-functions
-check4root
+check4root
|| exit 1
TMP=$(mktemp)
TMP=$(mktemp)