add python setuptools to installed image
[unleashed-kayak.git] / rpool-install.sh
blob448b410efaa0217ba63637a34671ebe85460d267
1 #!/usr/bin/bash
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
18 RPOOL=${1:-rpool}
19 ZFS_IMAGE=/root/*.zfs.bz2
20 keyboard_layout=${2:-US-English}
22 zpool list $RPOOL >& /dev/null
23 if [[ $? != 0 ]]; then
24 echo "Cannot find root pool $RPOOL"
25 echo "Press RETURN to exit"
26 read
27 exit 1
30 echo "Installing from ZFS image $ZFS_IMAGE"
33 . /kayak/disk_help.sh
34 . /kayak/install_help.sh
36 reality_check() {
37 # Make sure $1 (hostname) is a legit one.
38 echo $1 | egrep '^[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]$' > /dev/null
39 if [[ $? != 0 ]]; then
40 echo "[$1] is not a legitimate hostname."
41 return -1
43 return 0
46 # Select a host name
47 NEWHOST="unknown"
48 until [[ $NEWHOST == "" ]]; do
49 HOSTNAME=$NEWHOST
50 echo -n "Please enter a hostname or press RETURN if you want [$HOSTNAME]: "
51 read NEWHOST
52 if [[ $NEWHOST != "" ]]; then
53 reality_check $NEWHOST
54 if [[ $? != 0 ]]; then
55 NEWHOST=$HOSTNAME
58 done
60 # Select a timezone.
61 NEWTZ=$TZ
62 until [[ $NEWTZ == "" ]]; do
63 TZ=$NEWTZ
64 echo "Current timezone is [$TZ]: " `TZ=$TZ date`
65 echo "(NOTE: If time/date above looks wrong, the timezone name doesn't exist.)"
66 echo -n "Enter a new timezone, or just hit RETURN to accept [$TZ]: "
67 read NEWTZ
68 done
70 # Select a language
71 # XXX KEBE SAYS just use C for now
72 LANG=C
74 BuildBE $RPOOL $ZFS_IMAGE
75 ApplyChanges $HOSTNAME $TZ $LANG $keyboard_layout
76 MakeBootable $RPOOL
77 zpool list -v $RPOOL
78 echo ""
79 beadm list
80 echo ""
81 echo "$RPOOL now has a working and mounted boot environment, per above."
82 echo "Once back at the main menu, you can reboot from there, or"
83 echo "re-enter the shell to modify your new BE before its first boot."
84 echo -n "Press RETURN to go back to the menu: "
85 read