-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheinstall
More file actions
executable file
·184 lines (170 loc) · 5.74 KB
/
einstall
File metadata and controls
executable file
·184 lines (170 loc) · 5.74 KB
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
: " einstall Emacs and its addons "
# einstall with no args does
# interview background config
# emacs cmacs viplus adamacs
# einstall watch monitor background installation in progress
# einstall review examine installation log from beginning
# einstall interview collect user preferences in Settings file
# einstall background executes the remaining arguments in background
# einstall clean cleans the distribution directories
# einstall again re-does the most recent install in background
# einstall unupdate removes timestamps; next install will redo all
# einstall config configure sources according to Settings file
# einstall emacs install emacs, helper utilities, databases
# einstall compile compile emacs and helper utilities
# einstall viplus install viplus addon program
# einstall cmacs install cmacs addon program
# einstall adamacs install adamacs addon program
# einstall kill abort this installation (experimental)
#
# Assignment arguments (e.g., BINMOVE=cp) are passed on to Make.
# The assignment arguments must precede the object to which they refer.
# For example,
#
# einstall BINMOVE=cp emacs
#
# Each addon subsystem comes with a script, config/add<name>.sh, which expects
# to be invoked with the name of the operation it is supposed to perform as an
# argument. (e.g. config/addcmacs.sh install)
#
# Run this script from the distribution root (the directory in which it is
# supplied in the distribution). Run this as root.
#----------------------------------------------------------------------
# config/editor.sh will log its output in $EDITLOG if we set it here
#
EDITLOG=`/bin/pwd`/editor.LOG # comment this to disable editor logging
export EDITLOG
LOGFILE=einstall.LOG # background installations are logged here
PATH=:./config:$PATH; export PATH
# program names, relative to top-level distribution directory
#
TIME=/bin/time # runs its args follows by time summary
CONFIRM=config/confirm.sh
INTERVIEW=config/interview.sh
CONFIG=config/config.sh
ADDPREFIX=config/add # prepended to argument
# find the local equivalent of more
#
for MORE in more page pg cat
do if sh -c "$MORE /dev/null" >/dev/null 2>&1
then break
fi
done
#if [ -x /bin/uname -o -x /usr/bin/uname ] #because some machines dont have '-x'
if [ -r /bin/uname -o -r /usr/bin/uname ]
then HOSTNAME=`uname -s`
else HOSTNAME=`hostname`
fi
#if [ -x /usr/bin/id -o -x /bin/id ] #because some machines dont have '-x'
if [ -r /usr/bin/id -o -r /bin/id ]
then ID=`id`
else ID=$USER
fi
# arguments passed to make utility by install and compile
# Add dependencies intended for the src Makefile here, as in
# INSTALLEM='BINMOVE=cp temacs'
#
: "${INSTALLEM=install}" # default 'install emacs' dependency
: "${COMPILE=compile}" # default 'install compile' dependency
if [ $# = 0 ]
then set interview background config unupdate emacs cmacs viplus adamacs
fi
# LOGGING will be set to TRUE if we were started in background, or will
# otherwise be null.
#
if [ x$LOGGING != x ]
then echo "Emacs Installation Log: $*"
echo "System: $HOSTNAME `date` $ID"
fi
for i
do shift
case $i in
# Uppercase args are assumed to be variable settings
[A-Z]*)
eval $i # set it in einstall script itself
PARAMETERS="$PARAMETERS $i" # arrange for it to be passed down
;;
watch)
echo "Monitoring installation in progress in ${LOGFILE}:"
sed -n 1p $LOGFILE
echo " (type your interrupt character to return to your shell)"
echo
echo $$ >einstall.WPID
exec tail -f $LOGFILE
;;
review)
$MORE $LOGFILE
;;
again)
exec $0 background `sed -n '1s/^.*://p' $LOGFILE`
;;
kill)
if [ -f einstall.PID ]
then kill `cat einstall.PID` && rm einstall.PID
else echo "No installation is known to be in progress"
fi
;;
background)
echo
echo "Executing '"$0 $*"' into $LOGFILE"
( LOGGING=TRUE; export LOGGING;
exec $0 $* $PARAMETERS & echo $! >einstall.PID
)>$LOGFILE 2>&1
ASSIST=TRUE # loop control
until [ ASSIST = FALSE ]
do
WATCH=`$CONFIRM "Do you want to watch its progress? " TRUE`
if [ $WATCH = HELP ] # if user typed a ?
then cat config/watch.help # show the help file
else if [ $WATCH = TRUE ] # but if he typed 'TRUE'
then exec $0 watch # do an 'einstall watch'
ASSIST = FALSE # exit the loop
else echo "Type 'sh einstall watch' any time to monitor it."
exit 0 # exit to shell
fi
fi
done
;;
interview)
if $INTERVIEW # if the interview exits abnormally then kill
then prompt.sh "" # everything. Otherwise continue 'einstall'.
else exit 1 # since interview returned a 1, do likewise.
fi
;;
config)
echo; echo "Configuring Emacs sources"
$TIME $CONFIG
;;
unupdate)
echo; echo "Removing timestamps so all files will be installed"
(cd src; $TIME make unupdate $PARAMETERS)
;;
clean)
echo; echo "cleaning Emacs distribution: $PARAMETERS "
(cd src; $TIME make cleanall $PARAMETERS)
;;
emacs)
echo; echo "Installing: $INSTALLEM $PARAMETERS "
(cd src; $TIME make $INSTALLEM $PARAMETERS)
;;
compile)
echo; echo "Compiling: $COMPILE $PARAMETERS"
(cd src; $TIME make $COMPILE $PARAMETERS)
;;
# treat otherwise unrecognized args as name of an addon
*)
if [ -f $ADDPREFIX${i}.sh ]
then echo; echo "Installing $i"
(cd config; $TIME add${i}.sh install $PARAMETERS)
fi
;;
esac
done
# if we're logging into a file and someone did 'einstall watch', kill it
if [ x$LOGGING != x ]
then if [ -f einstall.WPID ]
then kill `cat einstall.WPID`
rm -f einstall.WPID
fi
rm -f einstall.PID >/dev/null 2>&1
fi