Merge ~mwhudson/casper:interactive-network-conf into casper:master

Proposed by Michael Hudson-Doyle
Status: Merged
Merged at revision: 2cd773c27e56f76794839c04ed598f6f1acb09b4
Proposed branch: ~mwhudson/casper:interactive-network-conf
Merge into: casper:master
Diff against target: 146 lines (+120/-0)
2 files modified
debian/changelog (+6/-0)
scripts/casper (+114/-0)
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+384006@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

So I tested this and found some immediate problems:

1) It takes an age to appear.
2) It needs one more : for ipconfig apparently, but it would be better to mimic ip=dhcp in the dhcp case.
3) our busybox wget does not support https.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Made some improvements, still doesn't work though for reasons I haven't attempted to determine.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oh it was just the uuid stuff stopping it working.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

So, we can use DPKG_ARCH variable for the architecture tag

And we can use etc/os-release for dynamically detecting the right version number & development series.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7946eec..a7a0160 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+casper (1.447) UNRELEASED; urgency=medium
7+
8+ * Add interactive network configuration.
9+
10+ -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 06 May 2020 19:51:18 +1200
11+
12 casper (1.446) groovy; urgency=medium
13
14 * control: add fdisk dependency
15diff --git a/scripts/casper b/scripts/casper
16index eafcde4..f09d874 100644
17--- a/scripts/casper
18+++ b/scripts/casper
19@@ -298,6 +298,114 @@ do_cifsmount() {
20 return ${rc}
21 }
22
23+do_interactive_netmount() {
24+ rc=1
25+ if [ -x /bin/plymouth ] && plymouth --ping; then
26+ plymouth hide-splash
27+ sleep 1
28+ fi
29+ echo "Unable to find a medium container a live file system"
30+ echo "Attempt interactive netboot from a URL?"
31+ read -p "yes no (default yes): " RET
32+ if [ "$RET" = "no" ]; then
33+ return ${rc}
34+ fi
35+
36+ # zdev
37+ if type lszdev 2>/dev/null 1>/dev/null; then
38+ echo "Available qeth devices:"
39+ # shellcheck disable=SC2005 disable=SC2046
40+ echo $(lszdev qeth --offline --columns id --no-headings | sed 's/:.*//') | fold -s -w 79
41+ read -p "zdev to activate (comma separated, optional): " zdev
42+ if [ -n "$zdev" ]; then
43+ chzdev -e $zdev
44+ fi
45+ fi
46+
47+ # dhcp vs static
48+ echo "Two methods available for IP configuration:"
49+ echo " * static: for static IP configuration"
50+ echo " * dhcp: for automatic IP configuration"
51+ read -p "static dhcp (default 'dhcp'): " proto
52+ # Yet support all the things linux kernel does
53+ case $proto in
54+ static|off|none)
55+ proto=none
56+ read -p "ip: " ipaddr
57+ read -p "gateway: " gateway
58+ read -p "dns: " dns
59+ ;;
60+ dhcp|on|any|"")
61+ export IP=dhcp ;;
62+ *)
63+ echo invalid option ;;
64+ esac
65+
66+ # vlan
67+ read -p "vlan id (optional): " vlanid
68+
69+ # pick interface
70+ interfaces=$(ls /sys/class/net | grep -v lo)
71+ count=$(echo $interfaces | wc -w)
72+ default_device=$(echo ${interfaces} | cut -d " " -f1)
73+ if [ "$count" -gt 1 ]; then
74+ if [ -n "$vlanid" ] || [ "$proto" = "none" ]; then
75+ echo "Available interfaces:"
76+ echo $interfaces | fold -s -w 79
77+ read -p "device (default $default_device): " DEVICE
78+ if [ -z "$DEVICE" ]; then
79+ DEVICE=$default_device
80+ fi
81+ fi
82+ fi
83+
84+ if [ "$proto" = "none" ]; then
85+ export IP=:$ipaddr:$gateway:::$DEVICE:$proto:$dns
86+ fi
87+
88+ # url & proxy
89+ echo "Please specify URL to the .iso Examples:"
90+ machine=$(uname -m)
91+ case $machine in
92+ x86_64) machine="amd64" ;;
93+ ppc64le) machine="ppc64el" ;;
94+ aarch64) machine="arm64" ;;
95+ esac
96+ case $machine in
97+ amd64)
98+ default_url=http://releases.ubuntu.com/focal/ubuntu-20.04-live-server-$machine.iso
99+ echo " $default_url (default)"
100+ echo " http://releases.ubuntu.com/focal/ubuntu-20.04-desktop-$machine.iso"
101+ ;;
102+ *)
103+ default_url=http://cdimage.ubuntu.com/releases/focal/release/ubuntu-20.04-live-server-$machine.iso
104+ echo " $default_url (default)"
105+ ;;
106+ esac
107+ read -p "url: " url
108+ if [ -z "$url" ]; then
109+ url=$default_url
110+ fi
111+ read -p "http_proxy (optional): " http_proxy
112+ if [ -n "$http_proxy" ]; then
113+ export http_proxy=$http_proxy
114+ fi
115+
116+ if [ -n "$vlanid" ]; then
117+ export VLAN=$DEVICE.$vlanid:$DEVICE
118+ DEVICE=$DEVICE.$vlanid
119+ export VLAN=$vlan
120+ fi
121+
122+ echo Configuring networking...
123+
124+ configure_networking
125+
126+ export NETBOOT=url
127+ export URL=$url
128+ do_netmount
129+}
130+
131 do_snap_copy ()
132 {
133 fromdev="${1}"
134@@ -768,6 +876,12 @@ mountroot() {
135 sleep 1
136 i="$(($i + 1))"
137 done
138+
139+ if [ -z "${livefs_root}" ]; then
140+ if do_interactive_netmount ; then
141+ livefs_root="${mountpoint}"
142+ fi
143+ fi
144 fi
145
146 if [ -z "${livefs_root}" ]; then

Subscribers

People subscribed via source and target branches