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 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
|
#!/bin/sh
# $Id: lessdisks-configure,v 1.14 2004/08/26 05:22:22 vagrant Exp $
# copyright 2004 jeff schwaber, distributed under the terms of the
# GNU General Public License version 2 or any later version.
# modifications made by vagrant@freegeek.org
# TODO give opportunities to edit lists of packages, etc.
: ${DIALOG=dialog}
# set ECHO to empty... so commands actually get run
ECHO=
lil_pause() {
echo
echo "hit enter to continue"
read
}
REPLY=$(dialog --stdout --inputbox "which text editor would you like to use?" 0 0 "$EDITOR")
if [ -z "$(which $REPLY)" ]; then
echo "invalid editor, exiting..."
exit 1
else
EDITOR=$REPLY
fi
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
configure_nfs(){
$DIALOG --title "Lessdisks Configuration -- /etc/exports" --clear \
--msgbox "Now, you're going to edit /etc/exports. \n\
We've taken the example /etc/exports file from \n\
/usr/share/doc/lessdisks/examples/\n\
and added it to the end of your /etc/exports. \n\
Please edit it until it is correct." 14 51
case $? in
0)
cat /usr/share/doc/lessdisks/examples/exports >> /etc/exports
$EDITOR /etc/exports
#$ECHO /etc/init.d/portmap restart
#$ECHO /etc/init.d/nfs-common restart
$ECHO /etc/init.d/nfs-kernel-server restart
lil_pause
;;
255)
echo "Goodbye."
exit;
;;
esac
}
get_dhcp() {
$ECHO apt-get -y install dhcp
lil_pause
# copy example into place, giving opportunity to back out now...
cp -i /usr/share/doc/lessdisks/examples/dhcpd.conf /etc/dhcpd.conf
$EDITOR /etc/dhcpd.conf
$ECHO /etc/init.d/dhcp restart
lil_pause
}
dhcp_warning(){
$DIALOG --title "Lessdisks Configuration -- DHCP Server" --clear \
--msgbox "Not installing DHCP Server.\n\
be sure to have a properly configured DHCP server\n\
somewhere on your network." 0 0
}
ask_dhcp_install(){
$DIALOG --title "DHCP" --clear \
--yesno "would you like to install a DHCP server?\n\
if you already have a DHCP server on the network, \n\
answer no and configure the existing DHCP server manually.\n\
see /usr/share/doc/lessdisks/examples/dhcpd.conf" 0 0
if [ "$?" = "0" ] ; then
get_dhcp
else
dhcp_warning
fi
}
terminal_ready(){
$DIALOG --title "Lessdisks Configuration -- Terminal Ready" --clear \
--msgbox "At this point you should be able to boot a terminal\n\
and get a console into the chroot. \n\
I'll wait while you do this. Also, try logging in\n\
The username is root, and there's no password." 10 60
case $? in
0)
;;
255)
echo "Goodbye."
exit;
;;
esac
}
install_sdm(){
$DIALOG --title "Lessdisks Configuration -- Installing SDM" --clear \
--msgbox "We're about to install SDM, and it's going to \n\
bring up some more dialog boxes, and I have no control over\n\
them. So I wanted to let you know that you should say yes to\n\
1)SSH protocol 2 only, 2) set the thing SUID root, 3) run sshd\n\
See you again when that's done." 10 60
case $? in
0)
$ECHO apt-get install -y sdm
$ECHO lessdisks-aptget install -y sdm-terminal
lil_pause
fix_ssh_config
;;
255)
echo "Goodbye."
exit;
;;
esac
}
fix_ssh_config(){
$DIALOG --title "Lessdisks Configuration -- Fixing SSH Config" --clear \
--msgbox "Welcome back. I'm about to put you into an edit window\n\
and I'd like you to look through the file (/etc/ssh/sshd_config)\n\
and find the line that says 'X11Forwarding no. Change that to\n\
'X11Forwarding yes'" 10 60
case $? in
0)
$EDITOR /etc/ssh/sshd_config
$ECHO /etc/init.d/ssh restart
lil_pause
;;
255)
echo "Goodbye."
exit;
;;
esac
}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
# source lessdisks configuration file
if [ -r /etc/lessdisks/server.config ]; then
. /etc/lessdisks/server.config
else
echo "couldn't find /etc/lessdisks/server.config"
echo "perhaps run lessdisks-install first?"
echo "exiting..."
exit 1
fi
install_swiftx(){
lessdisks-aptget install swiftx
lil_pause
fix_swiftx_config
}
fix_swiftx_config(){
$DIALOG --title "Lessdisks Configuration -- Fixing swiftx Config" --clear \
--msgbox "Okay. Time to fix the swiftx config. I'm going to put\n\
you in an editor with the file $lessdisks_path/etc/swiftx/swiftx.conf\n\
Look for the line:\n\
x_config_dir: <some setting>\n\
and set it to /var/state/lessdisks/etc/\n\
(don't forget the trailing slash...)" 12 60
case $? in
0)
$EDITOR $lessdisks_path/etc/swiftx/swiftx.conf
lil_pause
;;
255)
echo "Goodbye."
exit;
;;
esac
}
install_xfs(){
apt-get install xfs xfonts-base xfonts-100dpi xfonts-75dpi xfonts-scalable
lil_pause
fix_xfs_config
}
fix_xfs_config(){
$DIALOG --title "Lessdisks Configuration -- Fixing xfs Config" --clear \
--msgbox "Okay. Time to fix the xfs config. I'm going to put\n\
you in an editor with the file /etc/X11/fs/config\n\
Look for the line:
no-listen: tcp
and comment it out (with a # at the beginning of the line" 10 60
case $? in
0)
$EDITOR /etc/X11/fs/config
$ECHO /etc/init.d/xfs restart
lil_pause
;;
255)
echo "Goodbye."
exit;
;;
esac
}
final_notes(){
$DIALOG --title "Lessdisks Configuration -- Final Notes" --clear \
--msgbox "This is as far as we go together. There are still\n\
some things you need to do, and I'm going to give you\n\
some last notes.\n\
- You need to install some window managers. Try icewm, \n\
gnome, kde, ion, xfce, xfwm, and others. apt-get them\n\
EXAMPLE: apt-get install icewm\n\
- Any terminals with video cards that can't use xserver-xfree86\n\
will need their specific xservers. See swiftx's output for\n\
what server you'll need. You'll need to apt-get them in the chroot,\n\
so use the special script lessdisks-aptget for that.\n\
EXAMPLE: lessdisks-aptget install xserver-mach64\n\
Good luck." 18 78
}
install_dialogs(){
apt-get install xdialog dialog
lessdisks-aptget install xdialog dialog
lil_pause
}
install_xterm(){
apt-get install xterm
lil_pause
}
default_runlevel(){
if [ -z "$alt_x_display_command" ] || [ -z "$x_display_command" ]; then
if [ -e /etc/lessdisks/x.config ]; then
. /etc/lessdisks/x.config
fi
fi
if [ -n "$(echo $x_display_opts | egrep query)" ]; then
level_five="XDMCP (xdm/kdm/gdm)"
else
level_five="$x_display_command $x_display_opts"
fi
if [ -n "$(echo $alt_x_display_command | egrep sdm)" ]; then
level_four=sdm
else
level_four="$alt_x_display_command $x_display_opts"
fi
runlevel=$($DIALOG --stdout --title "$title" --clear \
--radiolist "Select default runlevel:" \
0 0 0 \
2 console off \
3 console off \
4 "$level_four" off \
5 "$level_five" on | \
sed s/\"//g)
case $runlevel in
2|3|4|5) mkdir -p /etc/lessdisks/terminals
echo runlevel=$runlevel >> /etc/lessdisks/terminals/default ;;
esac
}
yes_no(){
title=$1
shift
$DIALOG --stdout --title "$title" --clear \
--yesno "$@" 0 0
}
yes_no configure_nfs "configure /etc/exports in NFS server?" && configure_nfs
yes_no install_xfs "install XFS (X font server) and X fonts?" && install_xfs
ask_dhcp_install "configure DHCP server on this machine?"
yes_no install_sdm "configure terminal and server to use SDM?" && install_sdm
yes_no install_dialogs "install X dialog and dialog?" && install_dialogs
yes_no default_runlevel "set default runlevel for terminals?" && default_runlevel
yes_no install_xterm "install X terminal emulator xterm?" && install_xterm
yes_no install_swiftx "install swiftx X configuration tool?" && install_swiftx
final_notes
|