#!/usr/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/sn-chglogin - change login on external newsserver # # Creation : 2001 chriswue # Last update: $Id$ # # Copyright (c) 2001-2003 by Christian Wuerdig eisfair(at)chriswue(dot)de # Copyright (c) 2010-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- . /var/install/include/eislib . /var/lib/sn/sn.info tmp="/tmp/.snserv" # include passwdlib . /var/install/include/passwdlib # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- if [ ! -d ${OUTGOING} ] then echo mecho --warn "No external newsserver found." echo anykey exit 0 fi SN_TITLE='Change the login on an external newsserver' export SN_TITLE /var/install/bin/sn-getserver ret="${?}" ns='' if [ -f ${tmp} ] then touch /var/spool/news/.noservice cd ${OUTGOING} read ns < $tmp echo clrhome mecho -n --info "Selected is" mecho " '${ns}'" echo cd $ns:119/ echo ask_tmpfile=$(${MKTEMP} -t XXXXXXXXXXXXX) ${ASK} "Login required" > ${ask_tmpfile} rc=${?} read yesno < ${ask_tmpfile} rm -f ${ask_tmpfile} # if ask break, ask returned 255 if [ ${rc} = 255 ] then exit 0 fi if [ "${yesno}" = "yes" ] then echo ask_tmpfile=$(${MKTEMP} -t XXXXXXXXXXXXX) ${ASK} "Username" "" "*" > ${ask_tmpfile} rc=${?} read login < ${ask_tmpfile} rm -f ${ask_tmpfile} # if ask break, ask returned 255 if [ ${rc} = 255 ] then exit 0 fi # no username is given if [ -z "${login}" ] then exit 0 fi # function to get and check password # returned if true # _passwd=true get_passwd if "${_passwd:-false}" then echo ${login} >username echo ${password} >password cp /usr/sbin/SNHELLO SNHELLO chmod 600 username password chown news:news username password SNHELLO fi else mecho -n --info "Setting up" mecho -n " '${ns}'" mecho --info " with no Login" rm -f SNHELLO password username >/dev/null anykey fi rm -f ${tmp} rm -f /var/spool/news/.noservice else exit ${ret} fi exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------