QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 881|回复: 1

slrn setup script

[复制链接]
发表于 2005-6-30 13:43:00 | 显示全部楼层 |阅读模式
#! /bin/bash
# $0:slrn_config.sh
# purpose:slrn setup script,  [email protected]
RC="$HOME/.slrnrc"
MYFILE="$HOME/.bash_profile"
JRC="$HOME/.jnewsrc"

# is slrn installed?

which slrn > /dev/null 2>&1 ; RET=$? ; if [ "$RET" != "0" ]
then echo "No slrn was found." ; exit $RET ;fi

# .bash_profile editing  
cp -f $MYFILE ${MYFILE}.backup
grep -w 'NNTPSERVER' $MYFILE > /dev/null 2>&1 ; RETone=$?
if [ "$RETone" != "0" ] ; then
echo "News server is  not set , I make a free one."
echo 'export NNTPSERVER="freenews.netfront.net"' >> $MYFILE
fi

# is there a .jnewsrc file in home?
if [ -e "$HOME/.newsrc" ] ; then
  cp $HOME/.newsrc $JRC
fi
if [ ! -e "$JRC" ] ; then
MYLANG=`env | grep LANG | cut -d '=' -f2`
     case "$MYLANG" in
       zh_HK* | zh_TW*) echo 'tw.bbs.comp.linux:' > $JRC
                        echo 'tw.bbs.comp.mswindows:' >> $JRC
                        echo 'comp.unix.shell:' >> $JRC
                        ;;
                zh_CN*) echo 'cn.bbs.comp.linux:' > $JRC
                        echo 'cn.bbs.comp.mswindows:' >> $JRC
                        echo 'comp.unix.shell:' >> $JRC                                                 ;;
                     *) echo 'comp.unix.shell:' > $JRC
                        ;;
      esac
fi

# to make a .slrnrc file
echo "Some setting for slrn"
echo -n "Username? [default:$(whoami)]" ; read a
[ -z "$a" ] && a=$(whoami)
echo "set username \"$a\""  > $RC
echo -n "hostname? [default:invalid.net]" ; read b
[ -z "$b" ] && b='invalid.net'
echo "set hostname \"$b\"">> $RC
echo -n "replyto? [default:$(whoami)@invalid.net]" ; read c
[ -z "$c" ] && c=$(whoami)@invalid.net
echo "set replyto \"$c\""  >> $RC
echo -n "organization? " ; read d
[ -z "$d" ] && d=--
echo "set organization \"$d\""  >> $RC
echo -n "Do you want a signature? [y/n]" ; read yesno
case "$yesno" in
    [y|Y]) echo "$HOME/.signature is your signature file,you may edit it."
           echo "set signature \".signature\"" >> $RC
           ;;
        *) echo "set signature \"\"" >> $RC
           ;;
esac
echo 'set server_object "nntp"' >> $RC
echo 'set post_object "nntp"' >> $RC
echo -n 'Would you like to make directory to save posts? [y/n] '
read ans
if [ "x${ans}" = "xy" ] ; then
  echo 'set save_posts "News/My_Posts"' >> $RC
  echo 'Save posts at News/My_Posts'
fi
echo -n "Would you like to make directory to save replies? [y/n] "
read reply
if [ "x${reply}" = "xy" ] ; then
  echo 'set save_replies "News/My_Replies"' >> $RC
  echo 'Save replies at Mews/My_Replies'
fi
echo 'set save_directory "News"' >> $RC
echo 'set mime_charset "iso-8859-1"' >> $RC
echo 'compatible_charsets "Big5,gb2312"' >> $RC
echo 'set sorting_method 11' >> $RC
sed -n '/^[^%]/p' /etc/slrn.rc >> $RC

# summary and need to exec some command
echo ""
echo "---------read this-----------------------------------------"
echo ""
echo "Conglautions. setup is completed."
echo "you may make environment variable effected,"
echo "type source .bash_profile in $HOME directory"
echo "Running gnome-terminal , type slrn."
echo "Running in console mode , type zhcon into chinese terminal,"
echo "then type slrn"
echo "have fun."
echo ""
echo "---------End here-------------------------------------------"
发表于 2005-7-1 12:05:34 | 显示全部楼层
已阅
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-10-6 14:11 , Processed in 0.036603 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表