. /etc/grml/net-functions
. /etc/grml/script-functions
-check4root
+check4root || exit 1
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
. /etc/grml/lsb-functions
. /etc/grml/script-functions
-check4root
+check4root || exit 1
if ! [ -r "$CONFIG_FILE" ] ; then
eerror "$CONFIG_FILE could not be read."
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
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
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"
export LANG=C
export LC_ALL=C
-if [ "$UID" != 0 ]; then
+if [ $(id -ru) -ne 0 ] ; then
sudo $0
exit
fi
# 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
export LANG=C
DIALOG="dialog"
-if [ "$UID" != 0 ]; then
+if [ $(id -ru) -ne 0 ] ; then
sudo $0
exit
fi
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"
. /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."
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()
{
export LANG=C
export LC_ALL=C
-if [ "$UID" != 0 ]; then
+if [ $(id -ru) -ne 0 ] ; then
sudo $0
exit
fi
# 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)
export PATH LANGUAGE LANG
. /etc/grml/script-functions
-check4root
+check4root || exit 1
TMP=$(mktemp)