File: putegg

package info (click to toggle)
eggdrop 1.3.19-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 2,248 kB
  • ctags: 3,501
  • sloc: ansic: 38,705; tcl: 1,411; makefile: 524; sh: 487
file content (259 lines) | stat: -rw-r--r-- 5,854 bytes parent folder | download | duplicates (2)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#! /bin/sh
# script to copy vital files into another directory

cd /usr/lib/eggdrop

if test "$1" = ""; then
  echo ""
  echo "Usage: putegg <directory>"
  echo ""
  exit 1
fi

if test ! -d $1; then
  echo ""
  echo "Usage: putegg </full/pathname/of/directory>"
  echo ""
  exit 1
fi

if test ! -d $1; then
  echo ""
  echo "Attemping to create directory $1 ..."
  mkdir $1
  if test ! -d $1; then
    echo ""
    echo "Directory $1 is invalid."
    echo ""
    exit 1
  fi
  if test -r assoc.so; then
    echo "Making module directory $1/modules ..."
    mkdir $1/modules/
  fi
fi
if test ! -r $1; then
  echo ""
  echo "You don't have permission there!"
  echo ""
  exit 1
fi
if test ! -w $1; then
  echo ""
  echo "You don't have permission there!"
  echo ""
  exit 1
fi
if test ! -x $1; then
  echo ""
  echo "You don't have permission there!"
  echo ""
  exit 1
fi

if test ! -r eggdrop; then
  echo ""
  echo "You must run 'putegg' from the eggdrop directory!"
  echo ""
  exit 1
fi

if test ! -r $1/eggdrop; then
echo ""
  ./eggdrop -v
  echo "Copying eggdrop files into $1 ..."
  cp README $1
  cp weed $1
  if test -r assoc.so; then
    cp -p *.so $1/modules/
  fi
  cp eggdrop $1
else
  if test "$2" = "-q"; then
    ans=y
  else 
    echo "This appears to be an upgrade"
    echo "I can copy your old binary it oeggdrop"
    echo "to do this answer y/n"
    echo -n "   Rename old binary? (y/n) "
    read ans
    echo ""
  fi
  if test "$ans" = "y"; then
    echo "Renaming binary and Copying eggdrop files ..."
    echo ""
    ./eggdrop -v
    cp README $1
    cp weed $1
    if test -r assoc.so; then
      rm -f $1/modules/*.so.bak
      for i in $1/modules/*.so; do mv -f $i $i.bak; done
      cp -p *.so $1/modules/
    fi
    rm -f $1/oeggdrop
    mv -f $1/eggdrop $1/oeggdrop
    cp eggdrop $1
    echo ""
  else
    echo "Skipping Rename Coping the rest..."
    echo ""
    ./eggdrop -v
    cp README $1
    cp weed $1
    if test -r assoc.so; then
      cp -p *.so $1/modules
    fi
    rm -f $1/eggdrop
    cp eggdrop $1
    echo ""  
  fi
fi
if test "$2" = "-q"; then
  echo "Skipping rest 'cause it's not quick & dirty :P"
  exit 1
fi
#botcheck
if test ! -r $1/botchk;then
    echo "Copying botchk"
    cp botchk $1
else 
  echo "You appear to already have a botchk, would you like"
  echo "to keep it or would you like me to copy over it."
  echo -n "    Copy new botchk? (y/n)"
  read ans
  if test "$ans" = "y";then
  echo ""
  echo "Copying new botchk"
  echo ""
  rm -f $1/botchk
  cp botchk $1
  fi
fi
#eggdrop.conf
if test ! -r $1/eggdrop.conf;then
    echo "Copying eggdrop.conf"
    cp eggdrop.conf $1
else
    echo "You appear to already have a eggdrop.conf, would you like"
    echo "to keep it or would you like me to rename it."
    echo "Renaming will let you check for any changes to the format"
    echo -n "    Rename eggdrop.conf? (y/n)"
    read ans
    if test "$ans" = "y";then
      echo ""
      echo "Renaming eggdrop.conf"
      echo ""
      rm -f $1/eggdrop.conf.old
      mv -f $1/eggdrop.conf $1/eggdrop.conf.old
      cp eggdrop.conf $1
    fi
fi
#
if test -r $1/doc; then
  if test ! -d $1/doc; then
    echo "$1/doc is not a directory!  Skipping..."
  else
    echo "Copying documentation (please read it!) into $1/doc ..."
    cp -r doc/* $1/doc
  fi
else
  echo "Creating doc/ directory ..."
  mkdir $1/doc
  echo "Copying documentation (please read it!) into $1/doc ..."
  cp -r doc/* $1/doc
fi

if test -r $1/language; then
  if test ! -d $1/language; then
    echo "$1/language is not a directory!  Skipping..."
  else
    echo "Copying language into $1/language ..."
    cp -r language/* $1/language
  fi
else
  echo "Creating language/ directory ..."
  mkdir $1/language
  echo "Copying language into $1/language ..."
  cp -r language/* $1/language
fi

if test -r $1/help; then
  if test ! -d $1/help; then
    echo "$1/help is not a directory!  Skipping..."
  else
    if test "$2" = "-q"; then
      ans = y
    else  
      echo ""
      echo "You already have a help directory."
      echo "I can copy the new help files on top of your old ones.  That will"
      echo "overwrite any changes you've made, but any new help files you've"
      echo "written should be safe."
      echo -n "   Overwrite the old help files? (y/n) "
      read ans
      echo ""
    fi
    if test "$ans" = "y"; then
      echo "Copying help files ..."
      cp -r help/* $1/help
    else
      echo "Okay, skipping help files ..."
    fi
  fi
else
  echo "Creating help directory and copying help files ..."
  mkdir $1/help
  cp -r help/* $1/help
fi

if false
then

if test -r $1/text; then
  if test ! -d $1/text; then
    echo "$1/text is not a directory!  Skipping..."
  else 
    echo "Skipping text directory because you already have one ..."
  fi
else
  echo "Creating text directory and copying those files ..."
  mkdir $1/text
  cp text/* $1/text
  if test ! -r $1/motd; then
    cp motd $1
  fi
fi

fi

if test -r $1/filesys; then
  if test ! -d $1/filesys; then
    echo "$1/filesys is not a directory!  Skipping..."
  fi
else
  echo "Creating basic file-system directories ..."
  mkdir $1/filesys
  mkdir $1/filesys/incoming
fi

if test -r $1/scripts; then
  if test ! -d $1/scripts; then
    echo "$1/scripts is not a directory!  Skipping..."
  else
    echo "Updating the scripts that come with eggdrop ..."
    echo "   (If you modify these, be sure to use different names.)"
    cp scripts/* $1/scripts
  fi
else
  echo "Creating scripts directory ..."
  mkdir $1/scripts
  cp scripts/* $1/scripts
fi

echo ""
echo "Okay, copied the important stuff."
echo "If you haven't read the README file, then READ IT NOW!!!"
echo "If you're just upgrading, then you can safely erase this directory."
echo "Otherwise, you should probably keep it around for reference for a"
echo "little while."
echo ""