#!/bin/bash
#
PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin

TMP=/tmp
if [ ! -d $TMP ]; then
  mkdir $TMP
fi
TMP_DIR=$TMP/mnsetup
mkdir -p $TMP_DIR
chmod 700 $TMP_DIR
TMP=$TMP_DIR/tmp.$$

if [ -n "$DISPLAY" ]; then
   DIALOG=`type -path Xdialog`
   nb="--no-buttons"
else
   DIALOG=`type -path dialog`
fi

if [ ! -x "$DIALOG" ]; then
echo "I can't find \`dialog' on the system."
exit 1
fi

if [ ! "$UID" = "0" ]; then
cat << EOF > $TMP
[$LOGNAME] You need to run this script as root.
EOF
$DIALOG --title "Not Root!" --msgbox "`cat $TMP`" 6 60 2> $TMP
exit 1
fi

cat << EOF > $TMP
This is a script to setup mail and news on your system.  

It will setup "fetchmail" mail retriever, "mutt" mail reader, 
"pine" mail reader, "sylpheed" mail reader, "tin", "slrn"
and "pan" newsreaders.

You'll need to know a few things, username, password, and
email address.

You'll also need to know your service providers newsserver name,
mailserver name, and the mail protocol they use "pop3" etc. 

You may not have all the programs listed, just choose the
ones you have.
EOF

$DIALOG --title "READ" --yesno "`cat $TMP`" 0 0
if [ ! $? = 0 ]; then
rm -rf $TMP_DIR
echo
exit 
fi

if [ -n "$DISPLAY" ]; then
  on=on
else
  on=off
fi

$DIALOG --title "Setup choices." \
        --checklist "Use SPACE key to select the programs you want to setup.\
         Click in X." 0 0 0 \
        "Fetchmail" "Mail-retrieval program" on \
        "Mutt" "Mail-reader program" on \
        "Pine" "Mail-reader program" off \
        "Sylpheed" "X Mail-reader program" $on \
        "Pan" "X News-reader program" $on \
        "Slrn" "News-reader program" on \
        "Tin" "News-reader program" on 2> $TMP
if [ ! $? = 0 ]; then
    rm -rf $TMP_DIR
    echo
    exit
fi

setup_choices=`cat $TMP`

if [ "$setup_choices" = "" ]; then
    rm -rf $TMP_DIR
    exit
fi

editor() {
if [ -n "$DISPLAY" ]; then
ed="gvim, beaver, leafpad, mcedit, nano" 
Ed=beaver
else
ed="mcedit, nano, vim" 
Ed=mcedit
fi
cat << EOF > $TMP

Please enter the name of the editor you want to use.
Examples: $ed

EOF
   $DIALOG --title "EDITOR" --inputbox "`cat $TMP`" 10 60 $Ed 2> $TMP
   if [ ! $? = 0 ]; then
     exit
   fi 

   EDITOR=`cat $TMP`
   editor=`cat $TMP`

   if [ "$editor" = "" ]; then
   if [ -n "$DISPLAY" ]; then
      editor=beaver
   else  
      editor=mcedit
   fi
   else
    if echo $setup_choices | grep -q "Pan" ; then 
    if echo $editor | grep -q mcedit ; then
      EDITOR="xterm -fn 8x16 -e mcedit -x"
    elif echo $editor | grep -q nano ; then
      EDITOR="xterm -fn 8x16 -e nano"
    fi
    fi
   fi
}

muttrc() {
cat << EOF
# This is a \$HOME/.muttrc file used by the mail reader mutt.
#
# The format of this file is one command per line.  Everything after a pound
# sign (#) is a comment, unless a backward slash (\) precedes it.
#
# This is based on Dave Pearson's muttrc. <http://www.davep.org/mutt>
#
# User Defined Headers.
#
# You can put a From: and or a Reply-To: here.

my_hdr From: $FULLNAME <$EMAIL>      
my_hdr Reply-To: $EMAIL
  
# POP3 support.
# If you want mutt to connect to your service provider and get your
# pop3 mail, answer the questions below, then when you're in mutt 
# and connected, press the capital 'G' key.
#set pop_authenticators="user:apop:digest-md5:gssapi:cram-md5:"
#set pop_last		# Only read last unread mail.
#set pop_delete		# Delete mail after retrieving it.
$POP3

## The following options are only vaild if you have
## compiled in IMAP support.

# set imap_user=""
# set imap_pass=""
# set imap_checkinterval=""

# This is the default mailer for mutt.
#set sendmail="/usr/sbin/sendmail -oi -oem"

# You can put a Return-Receipt-To: if you want to be notified by sendmail
# when mail can't be delivered and why.
#my_hdr Return-Receipt-To: your@email.address
#set dsn_notify="failure,delay"   
#set dsn_return="hdrs"            

set sendmail="$sendmail"
$smtp

set folder="$HOME/Mail"  # Mail folder directory.
set spoolfile="$HOME/Mail/$USER"  # Mail folder.

set attribution="* %n <%a> [%{%Y-%m-%d %H:%M:%S %Z}]:\n"
set edit_headers                        # I want to edit the message headers.
set copy=ask-yes                        # Ask to keep copies of outgoing mail,
set postpone=ask-yes                    # Ask about postponing.
set postponed=+postponed
set print=ask-yes                       # Ask before printing.
set delete=ask-yes                      # Ask before doing a delete.
set record=+outbox                      # and it gets saved in outbox.
unset confirmappend
set autoedit
set sort=threads
set sort_aux=date-received              # Sort threads by date received.
set nobeep
set nomove
set mbox=+mbox                          # Where to put mail you read. 
set read_inc=100              
set write_inc=100              

set mailcap_path=$HOME/.mailcap:/etc/mailcap

auto_view text/html

#set editor="vi '+/^$'"         # Editor to use when composing messages
#set editor="nano +8"
#set editor="mcedit +8"
#set editor=builtin
set editor="$editor"

#set visual="nano +8"           # Editor invoked by ~v in the builtin editor
#set visual="vi '+/^$'"
#set visual="mcedit +8"
set visual="$editor"

set quote_regexp="^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"

# Ignore all headers
ignore *

# Then un-ignore the ones I want to see
unignore From:
unignore To:
unignore Reply-To:
unignore Mail-Followup-To:
unignore Subject:
unignore Date:
unignore Organization:
unignore Newsgroups:
unignore CC:
unignore BCC:
unignore Message-ID:
unignore X-Mailer:
unignore User-Agent:
unignore X-Junked-Because:
unignore X-SpamProbe:
unignore X-Virus-hagbard:

# Now order the visable header lines
hdr_order From: Subject: To: CC: BCC: Reply-To: Mail-Followup-To: Date: Organization: User-Agent: X-Mailer:

# Use the keys Ctrl-b to connect to URLs while in mutt.

macro index \cb |urlview\n
macro pager \cb |urlview\n	

#
# Colour settings for mutt.
#

# Default colour definitions
color hdrdefault black        cyan
color quoted     red          white
color signature  brightblack  white
color indicator  brightwhite  red
color attachment black        green
color error      red          white
color message    blue         white
color search     brightwhite  magenta
color status     brightyellow blue
color tree       red          white
color normal     blue         white
color tilde      green        white
color bold       brightyellow white
color markers    red          white

# Colour definitions when on a mono screen
mono bold      bold
mono underline underline
mono indicator reverse

# Colours for items in the reader
color header brightwhite cyan "^(From|Subject):"
color header red         cyan "^X-Junked-Because: "
color header red         cyan "^X-Virus-hagbard: .* FOUND"
mono  header bold             "^(From|Subject|X-Junked-Because|X-Virus-hagbard):"

# Colours for items in the index
color index brightblue  white ~N
color index brightgreen white "~N (~x hagbard\.davep\.org | ~h \"^In-[Rr]eply-[Tt]o: .*hagbard\.davep\.org\")"
color index red         white ~F
color index black       green ~T
color index brightwhite black ~D
mono  index bold              ~N
mono  index bold              ~F
mono  index bold              ~T
mono  index bold              ~D

# Highlights inside the body of a message.

# URLs
color body brightblue  white "(http|https|ftp|news|telnet|finger)://[^ \">\t\r\n]*"
color body brightblue  white "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
color body brightblue  white "news:[^ \">\t\r\n]*"
mono  body bold              "(http|https|ftp|news|telnet|finger)://[^ \">\t\r\n]*"
mono  body bold              "mailto:[-a-z_0-9.]+@[-a-z_0-9.]+"
mono  body bold              "news:[^ \">\t\r\n]*"

# email addresses
color body brightblue  white "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\\.[-a-z][-a-z]+"
mono  body bold              "[-a-z_0-9.%$]+@[-a-z_0-9.]+\\\.[-a-z][-a-z]+"

# Various smilies and the like
color body brightgreen white "<[Gg]>"
  # <g>
color body brightgreen white "<[Bb][Gg]>"
  # <bg>
color body brightgreen white " [;:]-*[)>(<|]"
  # :-) etc...
color body brightblue  white "(^|[[:space:]])\\\*[^[:space:]]+\\\*([[:space:]]|$)"
  # *Bold* text.
color body brightblue  white "(^|[[:space:]])_[^[:space:]]+_([[:space:]]|$)"
  # _Underlined_ text.
color body brightblue  white "(^|[[:space:]])/[^[:space:]]+/([[:space:]]|$)"
  # /Italic/ text.

# Last, but not least, get mutt to display its version on startup.
push V
EOF
}

pinerc() {
cat << EOF
# This is just a small .pinerc file.
# When you start "pine" it will create the complete .pinerc file,
# keeping whatever is in this one.

# Over-rides your full name from Unix password file. Required for PC-Pine.
personal-name=$FULLNAME

customized-hdrs=Reply-to: $EMAIL

# NNTP server for posting news. Also sets news-collections for news reading.
nntp-server=$NEWSSERVER

# Full path and name of NEWSRC file
newsrc-path=$HOME/.newsrc

folder-collections=Local-Mail $HOME/Mail/[]
$inbox_path
default-fcc=outbox
postponed-folder=postponed
read-message-folder=mbox

$pine_editor
EOF
}

tinrc() {
cat << EOF
# tin configuration file V1.3.8
# This file was automatically saved by tin 1.9.2 20070201 ("Dalaruan")
#
# Do not edit while tin is running, since all your changes to this file
# will be overwritten when you leave tin.
#
############################################################################

default_savedir=$HOME/News
default_maildir=$HOME/Mail
mm_network_charset=ISO-8859-1
post_mime_encoding=8bit
mail_mime_encoding=8bit
mail_address=$FULLNAME <$EMAIL>
default_pipe_command=urlview
metamail_prog=
ask_for_metamail=ON
inews_prog=--internal
auto_reconnect=ON
goto_next_unread=3
reread_active_file_secs=0
EOF
}

posting() {
cat << EOF
<?xml version="1.0" encoding="utf-8" ?>
<posting>

  <editors>
    <editor active="true">$EDITOR</editor>
    <editor>gvim -f</editor>
    <editor>kwrite</editor>
    <editor>xterm -e vim</editor>
  </editors>

  <profiles>
    <profile name="$FULLNAME">
      <username>$FULLNAME</username>
      <address>$EMAIL</address>
      <server>1</server>
      <attribution>On %d, %n wrote:</attribution>
    </profile>
  </profiles>

</posting>
EOF
}

servers() {
cat << EOF
<?xml version="1.0" encoding="utf-8" ?>
<server-properties>
  <server id="1">
    <host>$NEWSSERVER</host>
    <port>119</port>
    <username></username>
    <password></password>
    <expire-articles-n-days-old>31</expire-articles-n-days-old>
    <connection-limit>4</connection-limit>
    <newsrc>$HOME/.pan2/newsrc-1</newsrc>
    <rank>1</rank>
  </server>
</server-properties>
EOF
}

accountrc() {
cat << EOF
[Account: 1]
account_name=Account1
is_default=1
name=$FULLNAME
address=$EMAIL
organization=Linux
protocol=0
receive_server=$SITE
smtp_server=$SMTP_SERVER
nntp_server=
use_nntp_auth=0
user_id=$USR
password=$PASS
inbox=inbox
use_apop_auth=0
remove_mail=1
message_leave_time=0
get_all_mail=0
enable_size_limit=0
size_limit=1024
filter_on_receive=1
imap_check_inbox_only=0
imap_filter_inbox_on_receive=0
imap_auth_method=0
max_nntp_articles=300
receive_at_get_all=1
add_date=1
generate_msgid=1
add_custom_header=0
use_smtp_auth=0
smtp_auth_method=0
smtp_user_id=
smtp_password=
pop_before_smtp=0
signature_type=2
signature_path=
signature_text=
set_autocc=0
auto_cc=
set_autobcc=0
auto_bcc=
set_autoreplyto=0
auto_replyto=
default_sign=0
default_encrypt=0
encrypt_reply=1
ascii_armored=0
clearsign=0
sign_key=0
sign_key_id=
ssl_pop=0
ssl_imap=0
ssl_nntp=0
ssl_smtp=0
use_nonblocking_ssl=1
set_smtpport=0
smtp_port=25
set_popport=0
pop_port=110
set_imapport=0
imap_port=143
set_nntpport=0
nntp_port=119
set_domain=0
domain=
imap_directory=
imap_clear_cache_on_exit=0
set_sent_folder=0
sent_folder=
set_draft_folder=0
draft_folder=
set_queue_folder=0
queue_folder=
set_trash_folder=0
trash_folder=
EOF
}

folderlist() {
cat << EOF
<?xml version="1.0" encoding="UTF-8"?>

<folderlist>
    <folder type="mh" name="Mail" path="$HOME/Mail">
        <folderitem type="trash" name="trash" path="trash" threaded="1" mtime="0" new="0" unread="0" total="0" />
        <folderitem type="draft" name="draft" path="draft" threaded="1" mtime="0" new="0" unread="0" total="0" />
        <folderitem type="queue" name="queue" path="queue" threaded="1" mtime="0" new="0" unread="0" total="0" />
        <folderitem type="outbox" name="sent" path="sent" threaded="1" mtime="0" new="0" unread="0" total="0" />
        <folderitem type="inbox" name="inbox" path="inbox" threaded="1" mtime="1175431520" new="0" unread="0" total="0" />
    </folder>
</folderlist>
EOF
}

slrnrc() {
cat << EOF
% -*- slang -*-

%% This is a sample startup file for the slrn newsreader and meant as a
%% template for your personal startup file; it is not a full reference
%% of slrn's config options -- please see the reference manual for this.

%% The percent character is used for comments.

%
%% 1. Tell slrn about your identity (name, email address and such)
%

% The "From:" header will be generated from the following three variables.
% With the example settings, it would read "john@doe.com (John Doe)".
%set username "john"
%set hostname "doe.com"
set realname "$FULLNAME"

% Set this if you want replies to your articles to go to a address different
% from the one in "From:".
set replyto "$EMAIL"

% What to put into the "Organization:" header line.
%set organization "Doe inc."

% The name of your signature file.  If "", no signature is added.
%set signature ".signature"

%
%% 2. Server specific settings
%

% Tell slrn which newsrc file it should use for which server.
% Note: This does *not* set the default server; you need to set the
%       NNTPSERVER environment variable for this.
%server "news.doe.com" ".jnewsrc-doe"

% If a server requires authentication, add a nnrpaccess line for it.
% If you leave username and/or password empty, slrn will prompt for it.
%nnrpaccess "news.doe.com" "john" "secret"

% This can either be set to "nntp" (read online) or "spool" (use local spool)
%set server_object "nntp"

% This can be "nntp" (post directly to the server), "inews" (use external
% program for posting) or "slrnpull" (spool message for slrnpull to send).
%set post_object "nntp"

% Set this to zero if you want to leave Message-ID generation to your server
% or your system does not have a proper unique hostname.
%set generate_message_id 1

% If non-zero, slrn reads the active file on each startup.  You might want to
% use this if your network connection is fast or the server has few groups.
%set read_active 0

% The following variables are only meaningful when using spool mode:

% Basic directory settings
%set spool_inn_root "/var/lib/news"
%set spool_root "/var/spool/news"
%set spool_nov_root "/var/spool/news/over.view"

% These are relative to spool_inn_root unless they start with "/".
%set spool_active_file "data/active"
%set spool_activetimes_file "data/active.times"
%set spool_newsgroups_file "data/newsgroups"

% This value is relative to the directories under spool_nov_root:
%set spool_nov_file ".overview"

% Whether to check for each article when reading an overview file (slower,
% but may save you from lots of "article not available" errors).
%set spool_check_up_on_nov 0

%
%% 3. Which external programs do you want to use?
%

% Note OS/2 and Win32 users: 
%   To separate directories you can either use a single '/' or
%   double '\\'. Single backslashes are not supported.  For example, use
%   "C:\\home\\file.txt" or "C:/home/file.txt" but NOT "C:\home\file.txt"

% Set your favourite editor.  Use %s for the file name and %d for the line
% where the cursor should be placed (usually at the beginning of the body).
%set editor_command "jed '%s' -g %d -tmp"
set editor_command "$editor '%s'"

% You can have separate commands for editing posts, mail, and score files.
%set mail_editor_command "jed '%s' -g %d -tmp --mail-mode"
%set post_editor_command "jed '%s' -g %d -tmp --mail-mode"
%set score_editor_command "jed '%s' -g %d -tmp --score-arrange-score"

% If non-zero, abort posting or email operation if the file was not modified
% by the editor.
%set abort_unmodified_edits 0

% In case we need metamail to display an article:
%set metamail_command "metamail"

% WWW browser to use. Xbrowser is used when the DISPLAY environment variable
% is set; non_Xbrowser otherwise.
set non_Xbrowser "lynx '%s'"
set Xbrowser "firefox '%s' &"

% Command to use for printing
% Note: On Win32, this variable defines the name of the printer queue to use.
%set printer_name "lpr -Plp"

% In case you want to use another mailer than sendmail.  Be sure that it
% implements the same interface, though!
%set sendmail_command "/usr/lib/sendmail -oi -t -oem -odb"
set sendmail_command "$sendmail"

% Set this to one if you want the "From:" header in e-mails to be generated
% from the hostname / username / realname variable.
% Note: Not all MTAs are configured to allow this.
%set generate_email_from 0

%
%% 4. Directory / file names
%

% Note: All filenames in this section are relative to HOME unless they start
%       with a '/'.

% Filename where articles / email you sent are archived.
% Note: If these are unset, slrn does not keep a copy of outgoing messages.
%set save_posts "News/My_Posts"
%set save_replies "News/My_Replies"

% File where failed posts are appended.  Use "" to disable saving.
%set failed_posts_file "dead.letter"

% Name of score file.
%set scorefile "News/Score"

% Name of directory where decoded files are placed.
%set decode_directory "News"
  
% Directory where all other files are saved.
%set save_directory "News"

% Directory where postponed articles are placed. Please make sure it exists.
%set postpone_directory "News/postponed"

% Whether to put temporary files for postings, followups and replies in the
% directory specified by the TMPDIR environment variable or /tmp.
%set use_tmpdir 0

%
%% 5. Attribution lines / custom headers
%

% This sets the attribution lines for follow-ups and replies.  The following
% format specifiers are recognized:
%  %d:date, %D:date (formatted), %r:real name, %R:first name,
%  %f:email address, %s:subject, %m:msgid, %n:newsgroups, %%: percent
%set followup_string "On %d, %r <%f> wrote:"
%set reply_string "In %n, you wrote:"

% Custom headers to add to *new* posts
%set custom_headers "Mail-Copies-To: nobody"

% Custom headers for followup/reply/supersedes.  These can use format
% specifiers as in the 'followup_string' variable.
%set followup_custom_headers "Mail-Copies-To: nobody"
%set reply_custom_headers "X-newsgroup: %n\nX-realname: %r"
%set supersedes_custom_headers "X-Superseded-Date: %d"

% These are inserted when sending email CCs of your postings.
% cc_post_string currently does not support any % escapes.
%set cc_followup_string "[This message has also been posted to %n.]"
%set cc_post_string "[This message has also been posted.]"

%
%% 6. Character mapping / MIME support
%

% Character set used for the local display; valid values are:
%   isolatin, ibm850, ibm852, next, koi8
%set charset isolatin

% Character set to declare when posting 8bit characters. Do *not* use
% the same value as for "charset" here.
%set mime_charset "iso-8859-1"

% You may set this to a comma-separated list of MIME charsets your terminal
% is capable to display. The example adds two Chinese charsets:
%compatible_charsets "Big5,gb2312"

% If non-zero, call metamail for MIME formats slrn cannot handle.
%set use_metamail 1

%
%% 7. Some preferences for the header window (see the manual for more)
%

% These sorting methods are available:
% If 0, do not sort.  If 1, perform threading.  If 2, sort by subject.
% If 3, thread then sort result by subject.
% If 4, sort by score.  If 5, thread then sort by score.
% If 6, sort by score and subject.
% If 7, thread, then sort by score and subject.
% If 8, sort by date with most recent first.
% If 9, thread, then sort by date with most recent first.
% If 10, sort by date with most recent last.
% If 11, thread then sort by date with most recent last.
%set sorting_method 3

% If non-zero, a header with a new subject will start a new thread.
%set new_subject_breaks_threads 0

%
%% 8. Some preferences for the article pager (see the manual for more)
%

% Which headers do you want to see by default?
% You can also match all headers starting with a given string and exclude
% specific headers by preceding them with "!" (e.g. use "X-,!X-Trace:" to
% display all the "X-"headers except "X-Trace:").
%visible_headers "From:,Subject:,Newsgroups:,Followup-To:,Reply-To:"

% If non-zero, #v+ and #v- will be interpreted as markers of verbatim lines.
%set process_verbatim_marks	1

% If non-zero, hide #v+/#v- verbatim marks.
%set hide_verbatim_marks 0
  
% If non-zero, hide signature in articles.
%set hide_signature		0

% If non-zero, hide PGP signature in articles.
%set hide_pgpsignature		0

%
%% 9. Display / color settings
%

% If non-zero, slrn will draw the thread tree using simple ascii characters
%set simulate_graphic_chars 0

% Enable xterm/win32 mouse support: 1 to enable, 0 to disable
%set mouse 0

% Draw cursor bar ala tin instead of slrn "->" cursor?
%set display_cursor_bar	0

% Set to 1 to have slrn scroll by full page instead of by line.
%set scroll_by_page 0

% Should color be used to indicate the score of an article?
% (0) scores do not influence colors (1) scores are colored by their value
% (2) subjects are colored by score  (3) both are colored by score
%set color_by_score 3

% If non-zero, the subjects of unread articles are highlighted
%set highlight_unread_subjects 1

% If non-zero, URLs are highlighted.
%set highlight_urls 1

% Enables blinking in monochrome mode and allows bright backgrounds in some
% color terminals:
%set use_blink 1
EOF
} 
# End of slrnrc.

newsrc() {
cat << EOF
alt.comp.linux.isp:
alt.os.linux.caldera:
alt.os.linux.mandrake:
alt.os.linux.slackware:
alt.os.linux:
comp.mail.mutt:
comp.os.linux.advocacy:
comp.os.linux.alpha:
comp.os.linux.announce:
comp.os.linux.announce: 
comp.os.linux.answers:
comp.os.linux.development.apps:
comp.os.linux.development.system:
comp.os.linux.embedded:
comp.os.linux.hardware:
comp.os.linux.m68k:
comp.os.linux.misc:
comp.os.linux.networking:
comp.os.linux.portable:
comp.os.linux.powerpc:
comp.os.linux.security:
comp.os.linux.setup:
comp.os.linux.x:
comp.os.linux.xbox:
comp.protocols.ppp:
comp.windows.x.kde:
comp.windows.x.motif:
dc.org.linux-users:
it.comp.os.linux.annunci:
it.comp.os.linux.debian:
it.comp.os.linux.development:
it.comp.os.linux.iniziare:
it.comp.os.linux.mandrake:
it.comp.os.linux.redhat:
it.comp.os.linux.software:
it.comp.os.linux.sys:
linux.admin.news:
linux.debian.announce.devel:
linux.debian.announce.security:
linux.debian.announce:
linux.debian.beowulf:
linux.debian.bugs.dist:
linux.debian.bugs.rc:
linux.debian.changes.devel:
linux.debian.changes:
linux.debian.consultants:
linux.debian.curiosa:
linux.debian.devel.cd:
linux.debian.devel.french:
linux.debian.devel.italian:
linux.debian.devel.mentors:
linux.debian.devel.qa:
linux.debian.devel.release:
linux.debian.devel.spanish:
linux.debian.devel.testing:
linux.debian.devel:
linux.debian.doc:
linux.debian.isp:
linux.debian.kernel:
linux.debian.l10n.danish:
linux.debian.l10n.dutch:
linux.debian.l10n.finnish:
linux.debian.l10n.french:
linux.debian.l10n.german:
linux.debian.l10n.polish:
linux.debian.l10n.portuguese:
linux.debian.l10n.spanish:
linux.debian.l10n.turkish:
linux.debian.laptop:
linux.debian.legal:
linux.debian.maint.boot:
linux.debian.maint.dpkg:
linux.debian.maint.emacsen:
linux.debian.maint.firewall:
linux.debian.maint.glibc:
linux.debian.maint.gtk.gnome:
linux.debian.maint.hams:
linux.debian.maint.i18n:
linux.debian.maint.ipv6:
linux.debian.maint.java:
linux.debian.maint.jr:
linux.debian.maint.kde:
linux.debian.maint.ocaml.maint:
linux.debian.maint.perl:
linux.debian.maint.pilot:
linux.debian.maint.python:
linux.debian.maint.sgml:
linux.debian.maint.tetex:
linux.debian.maint.x:
linux.debian.news.french:
linux.debian.news.german:
linux.debian.news.portuguese:
linux.debian.news:
linux.debian.policy:
linux.debian.ports.68k:
linux.debian.ports.alpha:
linux.debian.ports.arm:
linux.debian.ports.hppa:
linux.debian.ports.hurd:
linux.debian.ports.ia64:
linux.debian.ports.mips:
linux.debian.ports.powerpc:
linux.debian.ports.s390:
linux.debian.ports.sparc:
linux.debian.ports.superh:
linux.debian.ports.x86-64:
linux.debian.project:
linux.debian.security:
linux.debian.user.catalan:
linux.debian.user.chinese.big5:
linux.debian.user.danish:
linux.debian.user.french:
linux.debian.user.german:
linux.debian.user.italian:
linux.debian.user.japanese:
linux.debian.user.polish:
linux.debian.user.portuguese:
linux.debian.user.russian:
linux.debian.user.spanish:
linux.debian.user.swedish:
linux.debian.user.turkish:
linux.debian.user.ukrainian:
linux.debian.user:
linux.debian.vote:
linux.debian.www:
linux.gentoo.announce:
linux.gentoo.dev:
linux.gentoo.user.de:
linux.gentoo.user.es:
linux.gentoo.user.kr:
linux.gentoo.user:
linux.gentoo.weekly-news:
linux.kernel:
linux.redhat.devel:
linux.redhat.install:
linux.redhat.misc:
linux.redhat.ppp:
linux.redhat.rpm:
linux.redhat:
linux.samba.announce:
linux.samba:
news.software.readers:
uk.comp.os.linux:
EOF
}

MSMTP() {
cat << EOF
#
# msmtprc -- a config file for mSMTP sendmail.
#
account default
host $SMTP_SERVER
from $EMAIL
#
syslog LOG_MAIL
EOF
}

procmailrc() {
cat << EOF
# Please check if all the paths in PATH are reachable, remove the ones that
# are not.

PATH=$HOME/bin:/usr/bin:/usr/sbin:/bin:/sbin:.

MAILDIR=$HOME/Mail	  # You'd better make sure it exists.

DEFAULT=\$MAILDIR/$USER
			  # We don't use a global lockfile here now,
			  # instead we use local lockfiles everywhere.
			  # This allows mail to arrive in all mailboxes
			  # concurrently, or allows you to read one mailbox
			  # while mail arrives in another.

# The next recipe will split up Digests into their individual messages.
# Don't do this if you use a global lockfile before this recipe (deadlock)

#:0:
#* ^Subject:.*Digest
#|formail +1 -d -s procmail

#LOGFILE=\$MAILDIR/from		# Put it here, in order to avoid logging
				# the arrival of the digest.

# An alternative and probably more efficient solution to splitting up a digest
# would be (only works for standard format mailbox files though):

#:0:
#* ^Subject:.*Other Digest
#|formail +1 -ds cat >>this_lists_mailbox

# Notice the double : in the next recipe, this will cause a lockfile
# named "\$MAILDIR/todd.lock" to be used if and only if this mail is going
# into the file "todd".

#:0:				# Anything from thf
#* ^From:.*thf@somewhere.someplace
#todd				# will go to \$MAILDIR/todd

# The next recipe will likewise use \$MAILDIR/uunetbox.lock as a lock file.

#:0:				# Anything from people at uunet
#* ^From:.*@uunet
#uunetbox			# will go to \$MAILDIR/uunetbox

# And here the lockfile will be \$MAILDIR/henries.lock of course.

#:0:				# Anything from Henry
#* ^From:.*henry
#henries			# will go to \$MAILDIR/henries

# But you can specify any lockfile you want, like "myfile".  The following
# recipe will use "\$MAILDIR/myfile" as the lock file.

#:0:myfile			# All 'questions' will go to
#* ^Subject:.*questions
#toread				# \$MAILDIR/toread

# Anything that has not been delivered by now will go to \$DEFAULT

# After procmail sees the end of the rcfile, it pretends that it sees a
# LOCKFILE=\$DEFAULT\$LOCKEXT
# Therefore \$DEFAULT is always locked.
EOF
}

mk_mail() {
mkdir -p $HOME/Mail
chmod 700 $HOME/Mail
chown $USER".$users" $HOME/Mail
touch $HOME/Mail/{$USER,postponed,outbox,mbox}
chmod 600 $HOME/Mail/$USER $HOME/Mail/*
chown $USER".$users" $HOME/Mail/$USER $HOME/Mail/*
echo "Created $HOME/Mail/$USER file:" >> $TMP
echo 'export MAIL="'$HOME/Mail/$USER'"' >> $HOME/.bash_login
chmod 600 $HOME/.bash_login
chown $USER".$users" $HOME/.bash_login
echo "$HOME/Mail/$USER" >>/tmp/tar_include
echo "$HOME/Mail/mbox" >>/tmp/tar_include
echo "$HOME/Mail/outbox" >>/tmp/tar_include
echo "$HOME/Mail/postponed" >>/tmp/tar_include
echo "$HOME/.bash_login" >>/tmp/tar_include
mail=no
}

NAMES="$LOGNAME root jerry mary"
[ "$LOGNAME" = "root" ] && NAMES="root jerry larry mary"

while [ 0 ]
do
cat << EOF > $TMP 
What's the name of the user on this system, you want 
to setup for mail and news?

Examples: $NAMES
EOF

$DIALOG --title "Username" --inputbox "`cat $TMP`" 11 60 $LOGNAME 2> $TMP

if [ ! $? = 0 ]; then
  rm -rf $TMP_DIR
  echo
  exit
fi

USER=`cat $TMP`
HOME="/home/$USER"
users=users

if [ -z "$USER" ]; then
continue
elif [ "$USER" = "root" ]; then
mkdir -p /root
HOME=/root
users=root
break
elif [ ! -d $HOME ]; then 
cat << EOF > $TMP
Home directory \`$HOME' not found!
EOF
$DIALOG --title "Not Found!" --msgbox "`cat $TMP`" 6 60 2> $TMP
continue
else
break
fi
done

if echo $setup_choices | grep -q "Pine" ; then 
cat << EOF > $TMP 
If your service provider has a pop3 mailserver, you
can have pine connect to it and read your mail.

Do you want pine to connect to a pop3 mailserver,
or just have pine read your mail on this system?

Answer Yes for connect.
EOF

$DIALOG --title "Connect to pop3 mailserver?" --yesno "`cat $TMP`" 12 60 2> /dev/null
if [ $? = 1 ]; then
pine_pop3=no
if [ "`echo $setup_choices | sed 's/\"Pine\"//g'`" = "" ]; then 
PINE_POP3=NO
fi
else
pine_pop3=yes
fi
fi

USR=name

if echo $setup_choices | grep -q -E "Fetchmail|Pine|Sylpheed" ; then 
if [ ! "$pine_pop3" = "no" -a ! "$PINE_POP3" = "NO" ]; then 
cat << EOF > $TMP 
What is your username or login name at the service provider?

Example: jerry
EOF

$DIALOG --title "Username" --inputbox "`cat $TMP`" 10 68 2> $TMP

if [ ! $? = 0 ]; then
rm -rf $TMP_DIR
exit
fi

USR=`cat $TMP`
fi
fi

if echo $setup_choices | grep -q -E "Fetchmail|Sylpheed" ; then 
cat << EOF > $TMP 
What is your password at the service provider?

Example: X1fG4opa
EOF

$DIALOG --title "Password" --inputbox "`cat $TMP`" 11 54 2> $TMP

if [ $? = 1 ]; then
rm -rf $TMP_DIR
exit
fi

PASS="`cat $TMP`"
fi

if echo $setup_choices | grep -q -E "Mutt|Tin|Slrn|Pine|Sylpheed|Pan" ; then 
cat << EOF > $TMP 
What is your email address?

Example: $USR@your.isp.com	
EOF

$DIALOG --title "Email Address" --inputbox "`cat $TMP`" 10 55 2> $TMP

if [ $? = 1 ]; then
rm -rf $TMP_DIR
exit
fi

EMAIL=`cat $TMP`

cat << EOF > $TMP 
What's your full name, first and last?

Example: Jerry Donut 	
EOF

$DIALOG --title "Full Name" --inputbox "`cat $TMP`" 10 45 2> $TMP

if [ $? = 1 ]; then
rm -rf $TMP_DIR
exit
fi

FULLNAME=`cat $TMP`
fi

if echo $setup_choices | grep -q -E "Mutt|Fetchmail|Pine|Sylpheed" ; then 
if [ ! "$pine_pop3" = "no" -a ! "$PINE_POP3" = "NO" ]; then 
cat << EOF > $TMP 
What is the name of your service
provider's incoming mail server?

Example: pop-server.your.isp.com	
EOF

$DIALOG --title "Mail Server" --inputbox "`cat $TMP`" 11 40 2> $TMP
if [ ! $? = 0 ]; then
  rm -rf $TMP_DIR
  exit
fi
  SITE=`cat $TMP`
fi

if echo $setup_choices | grep -q -E "Mutt|Pine|Sylpheed" ; then 
if [ -x "`type -path msmtp`" ]; then
cat << EOF > $TMP 
What is the name of your service provider's
outgoing smtp mail server?

Example: smtp-server.your.isp.com	
EOF

$DIALOG --title "Smtp Server" --inputbox "`cat $TMP`" 11 48 2> $TMP
if [ ! $? = 0 ]; then
  rm -rf $TMP_DIR
  exit
fi
  SMTP_SERVER=`cat $TMP`
  sendmail="`type -path msmtp`"
fi
fi
fi

if echo $setup_choices | grep -q "Fetchmail" ; then 
cat << EOF > $TMP 
What mail protocol does your service provider use?

Choices: apop auto etrn imap kpop odmr pop2 pop3 rpop sdps 

Example: pop3
If not sure put: auto
EOF

$DIALOG --title "Mail Protocol" --inputbox "`cat $TMP`" 0 0 pop3 2> $TMP

if [ $? = 1 ]; then
rm -rf $TMP_DIR
exit
fi

PROTO=`cat $TMP`
fi

if echo $setup_choices | grep -q -E "Tin|Slrn|Pine|Pan" ; then 
cat << EOF > $TMP 
What's the name of your service providers newsserver?

Example: news.your.isp.com	

If you don't put one 'news.edisontel.com (no posting)'
will be used (it may not work!). You can find listings
of free news servers on the net. Put the server in
/etc/nntpserver!
EOF

$DIALOG --title "News Server" --inputbox "`cat $TMP`" 17 64 2> $TMP

if [ ! $? = 0 ]; then
rm -rf $TMP_DIR
exit
fi

NEWSSERVER=`cat $TMP`

if [ "$NEWSSERVER" = "" ]; then
  NEWSSERVER="news.edisontel.com"
fi
fi

if echo $setup_choices | grep -q -E "Mutt|Tin|Slrn|Pine" ; then 
  editor
fi

cat << EOF > $TMP 
OK, I have the info. Should I continue and setup the files? 
EOF

$DIALOG --title "Continue?" --yesno "`cat $TMP`" 6 65
if [ ! $? = 0 ]; then
rm -rf $TMP_DIR
exit
fi

$DIALOG $nb --infobox "Setting up files..." 3 25
sleep 2
>$TMP 

rm -f /tmp/tar_include

if echo $setup_choices | grep -q "Fetchmail" ; then 
echo 'poll "'$SITE'"' > $HOME/.fetchmailrc
echo "protocol $PROTO" >> $HOME/.fetchmailrc
echo 'username "'$USR'"' >> $HOME/.fetchmailrc
echo 'password "'$PASS'"' >> $HOME/.fetchmailrc
echo 'mda "'/usr/bin/procmail -d %s'"' >> $HOME/.fetchmailrc
echo "keep" >> $HOME/.fetchmailrc

echo >> $HOME/.fetchmailrc
chmod 600 $HOME/.fetchmailrc
chown $USER".$users" $HOME/.fetchmailrc
echo "Created $HOME/.fetchmailrc file:" >> $TMP
echo "$HOME/.fetchmailrc" >>/tmp/tar_include

if [ ! "$mail" = "no" ]; then 
mk_mail
fi

procmailrc > $HOME/.procmailrc
chmod 600 $HOME/.procmailrc
chown $USER".$users" $HOME/.procmailrc
echo "Created $HOME/.procmailrc file:" >> $TMP
echo "$HOME/.procmailrc" >>/tmp/tar_include
fi

if echo $setup_choices | grep -q "Mutt" ; then 
POP3="
#set pop_last		# Only read last unread mail.
#set pop_delete		# Delete mail after retrieving it.
#set pop_host=\"\"	# Your service providers mail server.
#set pop_user=\"\"	# Your username. 
#set pop_pass=\"\"	# Your password."

if [ "$PROTO" = "pop3" ]; then 
if `mutt -v 2>/dev/null | grep -q "+USE_POP"` ; then
POP3="
set pop_last		# Only read last unread mail.
set pop_delete		# Delete mail after retrieving it.
set pop_host=\"$SITE\"	# Your service providers mail server.
set pop_user=\"$USR\"	# Your username. 
set pop_pass=\"$PASS\"	# Your password."
fi
fi

if [ -n "$SMTP_SERVER" ]; then
if mutt -v 2>/dev/null | grep -q "+USE_SMTP" ; then
smtp='#set smtp_url="'smtp://$SMTP_SERVER'"
'
fi
fi

muttrc > $HOME/.muttrc
chmod 600 $HOME/.muttrc
chown $USER".$users" $HOME/.muttrc
echo "Created $HOME/.muttrc file:" >> $TMP
echo "$HOME/.muttrc" >>/tmp/tar_include
if [ ! "$mail" = "no" ]; then 
mk_mail
fi

if [ -x "`type -path msmtp`" ]; then
MSMTP > $HOME/.msmtprc
chmod 600 $HOME/.msmtprc
chown $USER".$users" $HOME/.msmtprc
echo "Created $HOME/.msmtprc file:" >> $TMP
echo "$HOME/.msmtprc" >>/tmp/tar_include
fi
fi

if echo $setup_choices | grep -q "Sylpheed" ; then 
mkdir -p $HOME/.sylpheed-2.0
chmod 700 $HOME/.sylpheed-2.0
chown $USER".$users" $HOME/.sylpheed-2.0
accountrc > $HOME/.sylpheed-2.0/accountrc
folderlist > $HOME/.sylpheed-2.0/folderlist.xml
chmod 600 $HOME/.sylpheed-2.0/folderlist.xml $HOME/.sylpheed-2.0/accountrc
chown $USER".$users" $HOME/.sylpheed-2.0/folderlist.xml $HOME/.sylpheed-2.0/accountrc
mkdir -p $HOME/Mail/{draft,inbox,queue,sent,trash}
chmod 700 $HOME/Mail/{draft,inbox,queue,sent,trash}
chown $USER".$users" $HOME/Mail/{draft,inbox,queue,sent,trash}
echo "Created $HOME/.sylpheed-2.0 files:" >> $TMP
echo "$HOME/.sylpheed-2.0/accountrc" >>/tmp/tar_include
echo "$HOME/.sylpheed-2.0/folderlist.xml" >>/tmp/tar_include
echo "$HOME/Mail/draft" >>/tmp/tar_include
echo "$HOME/Mail/trash" >>/tmp/tar_include
echo "$HOME/Mail/inbox" >>/tmp/tar_include
echo "$HOME/Mail/queue" >>/tmp/tar_include
echo "$HOME/Mail/sent" >>/tmp/tar_include
fi

if echo $setup_choices | grep -q "Pan" ; then 
mkdir -p $HOME/.pan2
chmod 700 $HOME/.pan2
chown $USER".$users" $HOME/.pan2
posting > $HOME/.pan2/posting.xml
servers > $HOME/.pan2/servers.xml
newsrc > $HOME/.pan2/newsrc-1
chmod 600 $HOME/.pan2/{newsrc-1,servers.xml,posting.xml}
chown $USER".$users" $HOME/.pan2/{newsrc-1,servers.xml,posting.xml}
echo "Created $HOME/.pan2 files:" >> $TMP
echo "$HOME/.pan2/posting.xml" >>/tmp/tar_include
echo "$HOME/.pan2/servers.xml" >>/tmp/tar_include
echo "$HOME/.pan2/newsrc-1" >>/tmp/tar_include
fi

if echo $setup_choices | grep -q "Tin" ; then 
if `grep -q "mail_address=" $HOME/.tin/tinrc 2>/dev/null` ; then
if [ "$editor" = "" ]; then
cat $HOME/.tin/tinrc | sed "s/^.*mail_address=.*/mail_address=$FULLNAME <$EMAIL>/g" | \
> $HOME/.tin/tinrc.new
else
cat $HOME/.tin/tinrc | sed "s/^.*mail_address=.*/mail_address=$FULLNAME <$EMAIL>/g" | \
sed "s/^.*default_editor_format=.*/default_editor_format=$editor %F/g" > $HOME/.tin/tinrc.new
fi
mv $HOME/.tin/tinrc.new $HOME/.tin/tinrc
chmod 600 $HOME/.tin/tinrc
chown $USER".$users" $HOME/.tin/tinrc
chown $USER".$users" $HOME/.tin
echo "Put name & email address in $HOME/.tin/tinrc file:" >> $TMP
echo "mail_address=$FULLNAME <$EMAIL>" >> $TMP 
else
mkdir -p $HOME/.tin
chmod 700 $HOME/.tin
tinrc > $HOME/.tin/tinrc
chmod 600 $HOME/.tin/tinrc
chown $USER".$users" $HOME/.tin/tinrc
chown $USER".$users" $HOME/.tin
echo "Created $HOME/.tin/tinrc file with name & email address:" >> $TMP 
echo "$HOME/.tin/tinrc" >>/tmp/tar_include
fi
fi

if echo $setup_choices | grep -q "Slrn" ; then 
slrnrc > $HOME/.slrnrc
chmod 600 $HOME/.slrnrc
chown $USER".$users" $HOME/.slrnrc
echo "Created $HOME/.slrnrc file with name & email address:" >> $TMP 
echo "$HOME/.slrnrc" >>/tmp/tar_include
fi

if [ -n "$NEWSSERVER" ]; then
echo $NEWSSERVER > /etc/nntpserver
chown root.root /etc/nntpserver
echo "/etc/nntpserver" >>/tmp/tar_include
echo "Put newsserver in /etc/nntpserver file:" >> $TMP
if [ -f /usr/lib/lynx/lynx.cfg ]; then
sed "s/^NNTPSERVER.*/NNTPSERVER:"$NEWSSERVER"/g" /usr/lib/lynx/lynx.cfg > /tmp/lynx.cfg
mv /tmp/lynx.cfg /usr/lib/lynx
chown root.root /usr/lib/lynx/lynx.cfg
echo "/usr/lib/lynx/lynx.cfg" >>/tmp/tar_include
fi
fi

if echo $setup_choices | grep -q -E "Tin|Pine" ; then 
if [ ! -s $HOME/.newsrc ]; then
newsrc > $HOME/.newsrc
chmod 600 $HOME/.newsrc
chown $USER".$users" $HOME/.newsrc
echo "Created $HOME/.newsrc file:" >> $TMP
echo "$HOME/.newsrc" >>/tmp/tar_include
fi
fi

if echo $setup_choices | grep -q "Slrn" ; then 
if [ ! -s $HOME/.jnewsrc ]; then
newsrc > $HOME/.jnewsrc
chmod 600 $HOME/.jnewsrc
chown $USER".$users" $HOME/.jnewsrc
echo "Created $HOME/.jnewsrc file:" >> $TMP
echo "$HOME/.jnewsrc" >>/tmp/tar_include
fi
fi

if echo $setup_choices | grep -q "Pine" ; then 
echo "$HOME/.pinerc" >>/tmp/tar_include
if [ "$pine_pop3" = "yes" ]; then
inbox_path="#inbox-path=$HOME/Mail/$USER
inbox-path={$SITE/user=$USR}inbox"
elif [ "$pine_pop3" = "no" ]; then
inbox_path="inbox-path=$HOME/Mail/$USER"
fi
if [ ! "$editor" = "" ]; then
pine_editor="feature-list=enable-alternate-editor-implicitly
editor=$editor"
fi
if [ ! -f $HOME/.pinerc ]; then
pinerc > $HOME/.pinerc
else
cat $HOME/.pinerc | sed "/^.*nntp-server=.*/d" | sed "/^.*personal-name=.*/d" | \
sed "/^.*newsrc-path=.*/d" | sed "/^.*customized-hdrs=Reply-to:.*/d" | \
sed "/^.*inbox-path=.*/d" | sed "/^.*folder-collections=.*/d" > $HOME/.pinerc.new
mv $HOME/.pinerc.new $HOME/.pinerc
if [ ! "$editor" = "" ]; then
cat $HOME/.pinerc | sed "/^.*editor=.*/d" | \
sed "/^.*feature-list=enable-alternate-editor-implicitly.*/d" > $HOME/.pinerc.new
mv $HOME/.pinerc.new $HOME/.pinerc
echo "$pine_editor" >> $HOME/.pinerc
fi
echo "personal-name=$FULLNAME
customized-hdrs=Reply-to: $EMAIL
nntp-server=$NEWSSERVER
newsrc-path=$HOME/.newsrc
folder-collections=Local-Mail $HOME/Mail/[]
$inbox_path
default-fcc=outbox
postponed-folder=postponed
read-message-folder=mbox" >> $HOME/.pinerc
fi
chmod 600 $HOME/.pinerc
chown $USER".$users" $HOME/.pinerc
echo "Created $HOME/.pinerc file:
personal-name=$FULLNAME
customized-hdrs=Reply-to: $EMAIL
nntp-server=$NEWSSERVER
newsrc-path=$HOME/.newsrc
folder-collections=Local-Mail $HOME/Mail/[]
$inbox_path
default-fcc=outbox
postponed-folder=postponed
read-message-folder=mbox" >> $TMP
if [ ! "$editor" = "" ]; then
echo "feature-list=enable-alternate-editor-implicitly
editor=$editor" >> $TMP
fi
if [ ! "$mail" = "no" ]; then 
mk_mail
fi
fi
if [ ! "`echo $setup_choices | sed 's/\"Pine\"//g'`" = "" ]; then 
if [ ! -z "$NEWSSERVER" ]; then
if ! grep -q "^export NNTPSERVER=$NEWSSERVER" $HOME/.bash_login 2>/dev/null ; then
if grep -q "NNTPSERVER=" $HOME/.bash_login 2>/dev/null ; then
cat $HOME/.bash_login | sed "/^.*NNTPSERVER=.*/d" > $HOME/.bash_login.new
mv $HOME/.bash_login.new $HOME/.bash_login
echo 'export NNTPSERVER="'$NEWSSERVER'"' >> $HOME/.bash_login
else
echo 'export NNTPSERVER="'$NEWSSERVER'"' >> $HOME/.bash_login
fi
echo "Put newsserver in $HOME/.bash_login file:" >> $TMP
echo >> $TMP
fi
fi
fi

#if [ "$LOGNAME" = "$USER" ]; then
#echo "You can do this after you exit this script!" >> $TMP
#echo ". $HOME/.bash_login" >> $TMP
#fi

cat << EOF >> $TMP
Your networking software has been configured.

These are some X network programs on RIPLinuX:

# firefox   "WWW browser!"
# gaim      "IM client!"
# putty     "SSH/Telnet client!"
# pan       "Newsreader!"
# sylpheed  "Mail reader!"
# gftp      "Ftp client!"
# gaim      "AIM client!"
# xchat     "IRC client!"

These are some non X network programs on RIPLinuX:

# lynx (or) links   "WWW browsers!"   # msmtp   "Small mail delivery agent!"
# rtin (or) slrn    "Newsreaders!"    # telnet  "The telnet client!"
# ncftp (or) lftp   "Ftp clients!"    # wget    "The ftp/http file retriever!"
# irc        "The epic irc client!"   # whois   "The whois client!"
# fetchmail  "The mail client!"       # NFS SUPPORT!
# mutt       "The mail reader!"       # CIFS SUPPORT!
# naim       "IM client!"             # tmsnc   "MSN IM client!"

You can put any newsgroups you want to access in $HOME/.newsrc for tin
and $HOME/.jnewsrc for slrn.

To use 'wget' to download a file or directory in \`lynx', press \`.' when
the file or directory is highlighted.

EOF

if [ ! "$mail" = "n" ]; then
echo "To call \`mutt' for a \`mailto:', press \`.' when it's highlighted.
" >> $TMP
fi

echo "If you want to use \`lynx' to download anything, mount a partition
and use its tmp directory, because there may not be enough space on this
system for the temp file. For example:
# mount -t ext2 /dev/hda2 /mnt/linux
# export TMPDIR=/mnt/linux/tmp
# lynx

When you press enter on a image file (jpg, gif, png, etc.) in lynx,
it will be downloaded and the image viewer \`zgv' will be used to view it.
Press the [z] key to zoom in/out. Press the [Esc] key to exit zgv. 
" >> $TMP

if [ ! "$SITE" = "" ]; then
echo "If you want to connect to your mail account and retrieve your
mail, start \`fetchmail' then \`mutt' to read and respond to it.

The default is to keep mail on the server that has been retrieved.
If you want the mail to be deleted after it's retrieved, use the
\`-K' option \`fetchmail -K'. 

To use SSL \`fetchmail --ssl'.

If you want to connect to URLs (http, https, or ftp) found in mail you're
reading in mutt, press the \`Ctrl-b' keys and lynx will be called.
" >> $TMP
fi

cat $TMP > /usr/doc/RIPLinuX/mnsetup.txt
echo "/usr/doc/RIPLinuX/mnsetup.txt" >>/tmp/tar_include

if [ -f /tmp/skip_tmpfs ]; then
  rm -f /tmp/mnsetup.tgz
  tar czp -T /tmp/tar_include -f $HOME/mnsetup.tgz 2>/dev/null
echo "---------------------------------------------------------------------
I made a backup of the files here: $HOME/mnsetup.tgz

You can store 'mnsetup.tgz' on a USB device etc., so next time
you don't have to run 'mnsetup' and answer the questions again,
but can just do this.

Mount the device containing mnsetup.tgz, then extract it to /.

# mount /dev/sdb /mnt/usb
# tar xzvpf /mnt/usb/mnsetup.tgz -C /
---------------------------------------------------------------------
" >> $TMP
fi

echo "You can find this text in /usr/doc/RIPLinuX/mnsetup.txt!
" >> $TMP

$DIALOG --title "DONE" --textbox "$TMP" 0 0
rm -rf $TMP_DIR
