Package: menu
Version: 2.1.24
Severity: wishlist

Since some of my frech clients had ask me to make an i18l version of
su-to-root, I send you the resultat.

I have attached the 5 files (su-to-root, su-to-root.pot, su-to-root_de.po
and su-to-root_fr.po su-to-root.1) which are tested and they are working.

Additionaly I have attached the su-to-root_de.mo and su-to-root_fr.mo.

If you want to test it, do following:

1)  copy "su-to-root" into ~/bin and make sure it is in your Path

2)  mkdir -p ${HOME}/locale/{de,fr}/LC_MESSAGES

3)  mv su-to-root_de.po ${HOME}/locale/de/LC_MESSAGES/su-to-root.mo
    mv su-to-root_fr.po ${HOME}/locale/fr/LC_MESSAGES/su-to-root.mo

4)  I asum you have an english environement

5)  now open a terminal and try:

        su-to-root

    if you have am environement other then "de" or "fr" you will get
    english output.  Same if you try 
    
        su-to-root -c bash

6)  Now try the two above command with the environement variables

        [EMAIL PROTECTED] LANGUAGE=de su-to-root

    and

        [EMAIL PROTECTED] LANGUAGE=fr su-to-root


And last not least I hope it will go into Debian...  :-)

Oh yes, at the beginning of the su-to-root script I have definde two
variables currently GRP_LANG1 and GRP_LANG2.  here are setup the
languages which have the same reponse (letters) to "yes/no" and then
the function falsepasswd() must be adapted.

Note:   IF you want to use the modified version in the menu package,
        please change in the "su-to-root" script the line
        
            TEXTDOMAINDIR=${HOME}/locale
        to
            TEXTDOMAINDIR=/usr/share/locale

Greetings
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- System Information
Debian Release: 3.1
Kernel Version: Linux michelle1.private 2.4.27-2-386 #1 Wed Aug 17 09:33:35 UTC 
2005 i686 GNU/Linux


Versions of the packages menu depends on:
ii  dpkg           1.10.28        Package maintenance system for Debian
ii  libc6          2.3.2.ds1-22   GNU C Library: Shared libraries and Timezone
ii  libgcc1        3.4.3-13       GCC support library
ii  libstdc++5     3.3.5-13       The GNU Standard C++ Library v3

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)
#!/bin/bash
#                                                                    #
# Copyright 1998, Joost Witteveen <[EMAIL PROTECTED]>               #
# Modified  2006, Michelle Konzack <[EMAIL PROTECTED]>       #
#                                                                    #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions #
# are met:                                                           #
#                                                                    #
# 1. Redistributions of source code  must retain the above copyright #
#    notice, this list of conditions and the following disclaimer.   #
#                                                                    #
# 2. Redistributions  in  binary  form   must  reproduce  the  above #
#    copyright  notice, this  list of  conditions and  the following #
#    disclaimer in the documentation and/or other materials provided #
#    with the distribution.                                          #
#                                                                    #
# 3. Neither  the name  of Michelle  Konzack  nor the  names of  its #
#    contributors may be used to endorse or promote products derived #
#    from this software without specific prior written permission.   #
#                                                                    #
# THIS  SOFTWARE IS  PROVIDED BY  MICHELLE KONZACK  AND CONTRIBUTORS #
# ``AS IS'  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,  INCLUDING, BUT #
# NOT  LIMITED TO,  THE  IMPLIED WARRANTIES  OF MERCHANTABILITY  AND #
# FITNESS  FOR A  PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT #
# SHALL  JULIE  HAUGH OR  CONTRIBUTORS  BE  LIABLE FOR  ANY  DIRECT, #
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR #
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) #
# HOWEVER  CAUSED  AND  ON  ANY  THEORY  OF  LIABILITY,  WHETHER  IN #
# CONTRACT,  STRICT  LIABILITY,  OR TORT  (INCLUDING  NEGLIGENCE  OR #
# OTHERWISE) ARISING  IN ANY WAY  OUT OF  THE USE OF  THIS SOFTWARE, #
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                 #
#                                                                    #

. gettext.sh
export TEXTDOMAIN=su-to-root
export TEXTDOMAINDIR=${HOME}/locale

if test -r ~/.su-to-rootrc; then
. ~/.su-to-rootrc
fi

PRIV=root
COMMAND=
NEEDS=text

GRP_LANG1="de "
GRP_LANG2="fr "

eshell() {
   getent passwd $1 | cut -f7 -d:
}
usage() {
  GT1=$(gettext 'usage')
  GT2=$(gettext 'user')
  GT3=$(gettext 'command')
  GT4=$(gettext 'command is a X11 program')
  echo "${GT1}: $0 '[-X] [-p <${GT2}>] -c <${GT3}>" >&2
  echo "-X: ${GT4}" >&2
  exit 1
}

falsepasswd()
{
  ULANG=$(echo ${LC_MESSAGES} |sed 's/_.*//')
  if   [ -n "$(echo "${GRP_LANG1}" |grep -w "${ULANG}")" ] ; then
    FLAG=1
    ANS="j/n"
  elif [ -n "$(echo "${GRP_LANG2}" |grep -w "${ULANG}")" ] ; then
    FLAG=2
    ANS="o/n"
  else
    FLAG=0
    ANS="y/n"
  fi
  GT5=$(gettext 'Incorrect password or command failed. Try again?')
  echo -n "${GT5} (${ANS})"
  read ans
  if   [ ${FLAG} -eq 0 ] ; then
    if test "${ans}" != "y" -a "${ans}" != "Y"; then exit 1 ; fi
  elif [ ${FLAG} -eq 1 ] ; then
    if test "${ans}" != "j" -a "${ans}" != "J"; then exit 1 ; fi
  elif [ ${FLAG} -eq 2 ] ; then
    if test "${ans}" != "o" -a "${ans}" != "N"; then exit 1 ; fi
  fi
}

for i in "$@"; do
   case "${prev}" in
     -p)
       PRIV="${i}";;
     -c)
       COMMAND="${i}";;
     -X) 
       NEEDS="X11";;
   esac
   prev="${i}"
done

if [ -z "${COMMAND}" ] ; then
   usage;
fi

euid=$(id -u)
privid=$(id -u ${PRIV})
if test "${euid}" = "${privid}"; then
  ${COMMAND}
else
  case ${NEEDS} in
  text)
    if test "${euid}" != 0; then
      GT6=$(eval_gettext 'About to execute ${COMMAND}.')
      GT7=$(eval_gettext 'This command needs ${PRIV} privileges to be 
executed.')
      echo "${GT6}"
      echo "${GT7}"
    fi
    
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin
    SHELL=$(eshell ${PRIV})
    GT8=$(gettext 'Using sux...')
    GT9=$(eval_gettext 'enter ${PRIV} passwd:')
    if test "X${SU_TO_ROOT_SU}" = "Xsux"; then
      echo "${GT8}"
      echo "${GT9}"
      while ! sux -p "${PRIV}" "${COMMAND}"; do
        falsepasswd
      done
    else
      echo "${GT9}"
      while ! su - "${PRIV}" -c "${COMMAND}" ; do
        falsepasswd
      done
    fi;;
  X11)
    if test -z "${SU_TO_ROOT_X}"; then
      if which gksu >/dev/null 2>&1 ; then
        SU_TO_ROOT_X=gksu
      elif which kdesu >/dev/null 2>&1 ; then 
        SU_TO_ROOT_X=kdesu
      elif which sux >/dev/null 2>&1 ; then 
        SU_TO_ROOT_X=sux
      else
        SU_TO_ROOT_X=su-to-root
      fi
    fi
    if test "X${SU_TO_ROOT_X}" = "Xgksu" ; then
      gksu -u "${PRIV}" "${COMMAND}"
    elif test "X${SU_TO_ROOT_X}" = "Xkdesu" ; then 
      kdesu -u "${PRIV}" "${COMMAND}"
    elif test "X${SU_TO_ROOT_X}" = "Xsux" ; then
      env SU_TO_ROOT_SU=sux \
        x-terminal-emulator -e su-to-root -p "${PRIV}" -c "${COMMAND}"  
  # As a last resort, open a new x-terminal-emulator and prompt for the password
  # Do not use -X here!
    else
      x-terminal-emulator -e su-to-root -p "${PRIV}" -c "${COMMAND}"
    fi;;
  esac
fi
# This file is put in the public domain.
# Michelle Konzack <[EMAIL PROTECTED]>, 2006.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: menu \n"
"Report-Msgid-Bugs-To: <[EMAIL PROTECTED]>\n"
"POT-Creation-Date: 2006-08-15 18:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: su-to-root:22
msgid "usage"
msgstr ""

#: su-to-root:23
msgid "user"
msgstr ""

#: su-to-root:24
msgid "command"
msgstr ""

#: su-to-root:25
msgid "command is a X11 program"
msgstr ""

#: su-to-root:44
msgid "Incorrect password or command failed. Try again?"
msgstr ""

#: su-to-root:80
#, sh-format
msgid "About to execute ${COMMAND}."
msgstr ""

#: su-to-root:81
#, sh-format
msgid "This command needs ${PRIV} privileges to be executed."
msgstr ""

#: su-to-root:87
msgid "Using sux..."
msgstr ""

#: su-to-root:88
#, sh-format
msgid "enter ${PRIV} passwd:"
msgstr ""
# This file is put in the public domain.
# Michelle Konzack <[EMAIL PROTECTED]>, 2006.
#
msgid ""
msgstr ""
"Project-Id-Version: menu \n"
"Report-Msgid-Bugs-To: <[EMAIL PROTECTED]>\n"
"POT-Creation-Date: 2006-08-15 18:28+0200\n"
"PO-Revision-Date: 2006-08-15 18:34+0200\n"
"Last-Translator: Michelle Konzack <[EMAIL PROTECTED]>\n"
"Language-Team: german <[EMAIL PROTECTED]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

#: su-to-root:22
msgid "usage"
msgstr "anwendung"

#: su-to-root:23
msgid "user"
msgstr "benutzer"

#: su-to-root:24
msgid "command"
msgstr "befehl"

#: su-to-root:25
msgid "command is a X11 program"
msgstr "befehl ist ein X11 programm"

#: su-to-root:44
msgid "Incorrect password or command failed. Try again?"
msgstr "Unrichtiges Password oder Befehl versagte.  Nocheinmal versuchen?"

#: su-to-root:80
#, sh-format
msgid "About to execute ${COMMAND}."
msgstr "Im Begriff, ${COMMAND} auszuführen."

#: su-to-root:81
#, sh-format
msgid "This command needs ${PRIV} privileges to be executed."
msgstr "Dieser Befehl benötigt ${PRIV} rechte um ausgeführt zu werden."

#: su-to-root:87
msgid "Using sux..."
msgstr "Verwende sux..."

#: su-to-root:88
#, sh-format
msgid "enter ${PRIV} passwd:"
msgstr "${PRIV} Password eingeben:"
# This file is put in the public domain.
# Michelle Konzack <[EMAIL PROTECTED]>, 2006.
#
msgid ""
msgstr ""
"Project-Id-Version: menu \n"
"Report-Msgid-Bugs-To: <[EMAIL PROTECTED]>\n"
"POT-Creation-Date: 2006-08-15 18:28+0200\n"
"PO-Revision-Date: 2006-08-15 18:42+0200\n"
"Last-Translator: Michelle Konzack <[EMAIL PROTECTED]>\n"
"Language-Team: french <[EMAIL PROTECTED]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"

#: su-to-root:22
msgid "usage"
msgstr "utilisation"

#: su-to-root:23
msgid "user"
msgstr "utilisateur"

#: su-to-root:24
msgid "command"
msgstr "command"

#: su-to-root:25
msgid "command is a X11 program"
msgstr "command est in logiciel X11"

#: su-to-root:44
msgid "Incorrect password or command failed. Try again?"
msgstr "Incorrect mot de passe ou command refuser.  Esseyer encore un fois?"

#: su-to-root:80
#, sh-format
msgid "About to execute ${COMMAND}."
msgstr "En train de executer ${COMMAND}."

#: su-to-root:81
#, sh-format
msgid "This command needs ${PRIV} privileges to be executed."
msgstr "Cet command besoin des privilegues ${PRIV} pour l'execution."

#: su-to-root:87
msgid "Using sux..."
msgstr "Utilise sux..."

#: su-to-root:88
#, sh-format
msgid "enter ${PRIV} passwd:"
msgstr "mettrer le mot de passe pour ${PRIV}:"

Attachment: su-to-root_de.mo
Description: Binary data

Attachment: su-to-root_fr.mo
Description: Binary data

.\" Process this file with
.\" groff -man -Tascii foo.1
.\"
.\" "verbatim" environment (from strace.1)
.de CW
.sp
.nf
.ft CW
..
.de CE
.ft
.fi
.sp
..
.TH  su-to-root 1 "20 October 1998" "Debian Project" "Debian GNU/Linux manual"
.SH NAME
su-to-root \- A simple script to give an `interactive' front-end to su.
It can be used in menu entry commands to ask for the root password
.SH SYNOPSIS
.B su-to-root [-X] [\-p <user>] \-c <command>
.SH DESCRIPTION
Most menu entries simply start an editor or a game or whatever. But
some menu entries would like to give the user the ability to change
important settings in the system, that require root privileges. 
.B su-to-root
can be used to ask for the root password.
.SH OPTIONS
.IP "-c <command>"
The command to execute as a string. This option is mandatory.
.IP "-p <user>"
The name of the user to su to, instead of root.
.IP -X
The command is a X11 program that do not require a terminal.
This is to be used with menu entries that declare needs="X11".
.SH ENVIRONMENT
.IP SU_TO_ROOT_X
Select the su-like program called by \fBsu-to-root -X\fR.
Supported values are \fIgksu\fR, \fIkdesu\fR and \fIsux\fR.
.IP SU_TO_ROOT_SU
If set to \fIsux\fR force 
.B su-to-root 
to use \fIsux\fR in text mode.
.SH FILES
.IP ~/.su-to-rootrc
(\fBexperimental\fR)
\fBsu-to-root\fR will source this file at startup. This lets you define and
modify the environment variables above without restarting your X session.  
.SH COPYING
.B su-to-root
is distributed under the GNU General Public License.
(GPL 2.0 or greater).
.SH AUTHORS
Joost Witteveen
.RI <[EMAIL PROTECTED]>
.P
X11 support by Morten Brix Pedersen and Bill Allombert
.RI <[EMAIL PROTECTED]>
.P
Localized (german, french) 2006 by Michelle Konzack
.RI <[EMAIL PROTECTED]>
.SH "SEE ALSO"
.BR update-menus (1),
.BR menufile (5),
.BR /usr/share/doc/menu/html

Reply via email to