Merge ~xnox/ubuntu/+source/casper:ubuntu/devel into ubuntu/+source/casper:ubuntu/devel

Proposed by Dimitri John Ledkov
Status: Rejected
Rejected by: Robie Basak
Proposed branch: ~xnox/ubuntu/+source/casper:ubuntu/devel
Merge into: ubuntu/+source/casper:ubuntu/devel
Diff against target: 129 lines (+111/-0)
1 file modified
scripts/casper (+111/-0)
Reviewer Review Type Date Requested Status
Julian Andres Klode (community) Disapprove
git-ubuntu developers Pending
Review via email: mp+383189@code.launchpad.net

Commit message

    scripts/casper: add interactive network configuration

    If no local media is found, and no netboot is configured, offer to
    interractively configure URL netboot.

Description of the change

    scripts/casper: add interactive network configuration

    If no local media is found, and no netboot is configured, offer to
    interractively configure URL netboot.

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

Looks ok to me, some shell style comments (at least three different ways of formatting if statements!). How does this compare to how d-i did this?

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

responding to feedback.

60e5873... by Dimitri John Ledkov

Whitespace fixes

e8fb7de... by Dimitri John Ledkov

Rename 'none' to 'static'.

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

Fixed up review comments so far, still need to test this.

Revision history for this message
Julian Andres Klode (juliank) wrote :

This has been merged already, closing.

review: Disapprove

Unmerged commits

e8fb7de... by Dimitri John Ledkov

Rename 'none' to 'static'.

60e5873... by Dimitri John Ledkov

Whitespace fixes

83d64f1... by Dimitri John Ledkov

scripts/casper: add interactive network configuration

If no local media is found, and no netboot is configured, offer to
interractively configure URL netboot.

7e26f48... by Michael Hudson-Doyle

Import patches-unapplied version 1.445 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 0bccfcc553b20388582baea8c89aa4178350a254

New changelog entries:
  * Fix segfault in casper-md5check when plymouth is not installed (i.e.
    Ubuntu Server).

0bccfcc... by Michael Hudson-Doyle

Import patches-unapplied version 1.444 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 651b64f52a8920aec68bb284d9654465952c48ef

New changelog entries:
  * Move check for fallback persistent filesystem label (casper-rw) later as
    it seems sometimes it takes time for block devices to appear and be
    processed by udev. (LP: #1863672)

651b64f... by Dimitri John Ledkov

Import patches-unapplied version 1.443 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 0689ec6e50001c11c2db158d2545565641eb12ef

New changelog entries:
  * Make fsckd under spinner/logo themes produce consistent output
  * Make plymouth-less progress output less bad
  * Use theme-specific keys: or fsckd-cancel-msg: for Ctrl+C message LP:
    #1870018
  * Add fsck.mode=skip sensitivity to casper-md5check
  * ubuntu-server: skip mounting swap (as hacked by livecd-rootfs currently)
  * Leave fsck result as a json /run/casper-md5check.json file.
  * ubuntu-server: adapt runtime netplan into cloud-config cloud.cfg
  * Fix cmdline parsing, it was always broken

0689ec6... by Dimitri John Ledkov

Import patches-unapplied version 1.442 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 1540d20b6058f14af92c8efe6e6b196513957a6b

New changelog entries:
  * casper-md5check:
    + change progress messages to fsckd compatible ones
    + use Ctrl+C to cancel them

1540d20... by Dimitri John Ledkov

Import patches-unapplied version 1.441 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: c83900291e49492642e4ca5ff29947a810d56054

New changelog entries:
  * casper-md5check:
    + flush pending events for actually fluid progress updates
    + drop reboot includes
    + watch for s keystroke to skip checks
    + always finish on 100% update, to remove the progress message
    + always drop the keystrokes message
    + always display the result of the checks, with a slight delay
    + make the failed message linger for longer
    + clear all messages before quiting
    + ignore unused-result warnings during compilation

c839002... by Dimitri John Ledkov

Import patches-unapplied version 1.440 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: 62a0dec8c55a29d1b2f513063d03432e3d458fcc

New changelog entries:
  * casper-md5check:
    + Use fsck progress text, whilst verifying the disk.
    + Do not reboot, but simply continue booting after the integrity check.
    + Perform integrity check on every boot (TODO allow skipping the check)

62a0dec... by Michael Hudson-Doyle

Import patches-unapplied version 1.439 to ubuntu/focal-proposed

Imported using git-ubuntu import.

Changelog parent: bbd782ad4ce9c110d0b3ac7b82c9e54ac38fd1db

New changelog entries:
  * Create partitions with label "writable" rather than "casper-rw" (but still
    use a partition with label "casper-rw" in preference to creating one).
    (LP: #1861512)

Preview Diff

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

Subscribers

People subscribed via source and target branches