summaryrefslogtreecommitdiffstats
path: root/installer/ld4-inst
blob: c7a79f9479e425d6d29f1c9725156280904369bf (plain) (blame)
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
#! /bin/bash
#
# Description:  Script for generating dxs filesystem by
#               cloning from rsync source for Diskless X Stations (v4.0)
#
# Author(s):    Dirk von Suchodoletz <dirk@goe.net>, 02-11-2005
# Copyright:    (c) 2003, 2005 - RZ Universitaet Freiburg
#


header() {
  echo
  echo "Welcome to the LD4 installation"
  echo
}

# check needed things for installation
precheck() {
  # check if running as root

  # check for existing programs: 
    # rsync (server-side) -> which
    # ssh, rsync (referenz-system-side) -> not possible in precheck

    # nfs-kernel-server, atftpd 
    #  -> not needed for installation
}


# ask question variable_name default_value
ask() {
  echo
  echo "$1"
  echo -n "* [ $3 ] "
  read userinput
  if [ -z $userinput ] ; then
      local back=$3
  else
      local back=$userinput
  fi
  echo "$2=\"$back\"" >> .config
}


configure() {
  export LANG="c"
  
  if [ -f .config ] ; then
    echo -n "Use values from last installation? [Y/n] "
    read userinput
    if [ "x$userinput" = "xn" ] ; then
      cp .config.default .config
    fi
  else
    cp .config.default .config
  fi
  . .config

  if ! [ -z $netmask -a -z $broadcast -a -z $netname -a -z $server ] ; then
    ipcfg=( `ifconfig eth0 | grep "inet addr" | sed -e "s,[a-zA-Z]*:,,g"` )
    netmask=${ipcfg[3]}
    broadcast=${ipcfg[2]}
  # quickhack (more intelligent solution needed ...)
    netname=`route -n | grep -m 1 eth0 | grep -v "UG" | awk '{ print $1 }'`
    server=${ipcfg[1]}
  fi


  # missing: try to detect server architecture

  # missing: ask for client & server distro
 
  
  # das grosse frage-antwort-spiel:
  ask "Path for client system: " rootdir $rootdir
  ask "Path for tftpboot: " tftpbootdir $tftpbootdir
  ask "Which network do you want to use for DXS? (A.B.C.0) " netname $netname
  ask "Which netmask should be used? (255.B.C.0): " netmask $netmask
  ask "What is your servers IP for NFS, DHCP and TFTP? " server $server
  # noetig??
  ask "Broadcast Address: " broadcast $broadcast

  # evtl. optional?
  ask "Where automount home directories from? (A.B.C.D:/home-dir)" amt $server":/home"

  ask "Which debug level should be used? " debuglevel $debuglevel

  # wo ist das referenzsystem?

  # hier auch dns-server etc abfragen??

  # nfs / nbd / squash-fs?
}


copy_system() {
  . exclude-${client_distro}

  # sync / mksquashfs

}

# setting up server site configuration files etc.
setup_server () {
  # rewrite and copy / cat default files (may be distro-dependant): 
    # dhcpd.conf, atftpd, exports
  # make services start
}


create_initrd() {

}


## ------ MAIN ------ ##

header
precheck #(run as root, rsync etc.)
configure
copy_system
setup_server
create_initrd