File: linpac.in

package info (click to toggle)
linpac 0.16pre3-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,328 kB
  • ctags: 2,582
  • sloc: cpp: 16,514; sh: 7,991; ansic: 4,061; makefile: 211; perl: 101
file content (179 lines) | stat: -rwxr-xr-x 4,462 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#! /bin/sh
############################################################################
# LinPac startup script (model 0.14)                                       #
############################################################################

if [ x$HOME = x ]; then
  echo 'Cannot determine your home directory - $HOME is not set'
  exit 1
fi

DIRNAME=LinPac
PREFIX=@prefix@
VERSION=@VERSION@
HOMEDIR=$HOME/$DIRNAME
SHAREDIR=$PREFIX/share/linpac

if [ ! -d $HOMEDIR ]; then
  echo 'Hello dear user. You seem to run LinPac for the first time.'
  echo 'LinPac has to create a directory in your home directory for storing'
  echo 'your personal configuration.'
  echo
  echo 'For creating your personal configuration please answer following questions:'
  echo
  echo Your callsign:
  read CALLSIGN
  CALL=`echo $CALLSIGN | tr [a-z] [A-Z]`
  echo
  echo Enter your home BBS callsign:
  read BBSCALLS
  BBSCALL=`echo $BBSCALLS | tr [a-z] [A-Z]`
  echo Enter the name of port for connecting $BBSCALL
  read BBSPORT
  echo Enter the digipeaters used to connect $BBSCALL or press enter 
  echo when no digipeaters are used:
  read DIGIPTS
  DIGIS=`echo $DIGIPTS | tr [a-z] [A-Z]`
  echo Enter the full hierarchical address of $BBSCALL
  echo '(e.g. #MOR.CZE.EU)'
  read HIADDR
  HADDR=$BBSCALL.`echo $HIADDR | tr [a-z] [A-Z]`
  echo
  echo Thank you, $CALL
  BBSADDR="$BBSPORT:$BBSCALL $DIGIS"
  
  echo Please wait a moment for creating your personal configuration

  mkdir $HOMEDIR

  #create subdirectories
  mkdir $HOMEDIR/bin
  mkdir $HOMEDIR/macro
  mkdir $HOMEDIR/save
  mkdir $HOMEDIR/user
  mkdir $HOMEDIR/log
  mkdir $HOMEDIR/mail
  mkdir $HOMEDIR/mail/$BBSCALL
  mkdir $HOMEDIR/plugins
  
  if [ ! -d /var/ax25/mail/$BBSCALL ]; then
    mkdir -p /var/ax25/mail/$BBSCALL
  fi

  PWDBEFORE=`pwd`

  #copy 'mail'
  cd $SHAREDIR/mail
  for I in *; do
    if [ ! -x $I ]; then
      cp $I $HOMEDIR/mail/$I
    fi
  done

  #copy 'bin'
  cd $SHAREDIR/bin
  for I in *; do
    if [ $I = commands ]; then
      cp $I $HOMEDIR/bin/$I
    else
      ln -s `pwd`/$I $HOMEDIR/bin/$I
    fi
  done

  #copy 'macro'
  cd $SHAREDIR/macro
  for I in *; do
    if test -d $I; then
      mkdir $HOMEDIR/macro/$I
      cd $I
      for J in *; do
        cp $J $HOMEDIR/macro/$I
      done
      cd ..
    else
      if [ $I = init.mac ]; then
        sed "s/#CALL#/$CALL/; s/#BBS#/$BBSADDR/; s/#ADDR#/$HADDR/; s/#PORT#/$BBSPORT/" <$I >$HOMEDIR/macro/$I
      else
        cp $I $HOMEDIR/macro/
      fi
    fi
  done

  #copy root
  cd $SHAREDIR
  cp station.data $HOMEDIR
  for I in *.ctt; do
    cp $I $HOMEDIR/$I
  done

  cd $PWDBEFORE
  
  echo $VERSION > $HOMEDIR/plugins/version

  echo Instalation done.
  echo Press ENTER to run LinPac
  read ENTER

else ############ LinPac alreasy installed, check the version ##############
  
  OLDVER=`cat $HOMEDIR/plugins/version 2> /dev/null`
  if [ ! "$OLDVER" = "$VERSION" ]; then
    echo "LinPac version was updated to $VERSION"
    echo "Some macros may have been updated in this version. Would you like to update"
    echo "the macros in your home directory? (your current macros will be backed up"
    echo "to the macro.old directory). If you answer NO to the following question LinPac"
    echo "won't ask you next time."
    echo -n "Continue updating [Y/n]? "
    read ANSWER
    ANSWER=`echo $ANSWER | tr [a-z] [A-Z]`
    if [ "$ANSWER" = "Y" -o "$ANSWER" = "YES" ]; then
      cd $HOMEDIR
      rm -rf macro.old
      mv macro macro.old
      mkdir macro
      cp macro.old/init.mac macro

      #copy 'macro'
      cd $SHAREDIR/macro
      for I in *; do
        if test -d $I; then
          mkdir $HOMEDIR/macro/$I
          cd $I
          for J in *; do
            cp $J $HOMEDIR/macro/$I
          done
          cd ..
        else
          if [ ! $I = init.mac ]; then
            cp $I $HOMEDIR/macro/
          fi
        fi
      done
    fi
      
    echo $VERSION > $HOMEDIR/plugins/version
  fi  
fi

#PATCH991003# Setup new installed plugins for current user
if ! test -d $HOMEDIR/plugins ; then
  mkdir $HOMEDIR/plugins
fi
cd $SHAREDIR/plugins
for PLUGIN in * ; do
  cd $SHAREDIR/plugins
  if test -x $PLUGIN ; then
    if ! test -r $HOMEDIR/plugins/$PLUGIN ; then
      cd $HOMEDIR
      export SHAREDIR
      eval $SHAREDIR/plugins/$PLUGIN
      date +%y%m%d > $HOMEDIR/plugins/$PLUGIN
    fi
  fi
done

cd $HOMEDIR
export PATH=$PATH:$SHAREDIR/mail:$SHAREDIR/tools
$SHAREDIR/linpac $*
exit $?