fix paths to zoneinfo
[unleashed-kayak.git] / rpool-install.sh
blob915830f940e481aa0992351252f185360a0191d7
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=/.cdrom/image/*.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 # Because of kayak's small miniroot, just use C as the language for now.
71 LANG=C
73 BuildBE $RPOOL $ZFS_IMAGE
74 ApplyChanges $HOSTNAME $TZ $LANG $keyboard_layout
75 MakeBootable $RPOOL
76 zpool list -v $RPOOL
77 echo ""
78 beadm list
79 echo ""
80 echo "$RPOOL now has a working and mounted boot environment, per above."
81 echo "Once back at the main menu, you can reboot from there, or"
82 echo "re-enter the shell to modify your new BE before its first boot."
83 echo -n "Press RETURN to go back to the menu: "
84 read