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

Proposed by Dimitri John Ledkov
Status: Needs review
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
Ubuntu Server Dev import team 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.

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
diff --git a/scripts/casper b/scripts/casper
index eafcde4..6f05a3d 100644
--- a/scripts/casper
+++ b/scripts/casper
@@ -298,6 +298,111 @@ do_cifsmount() {
298 return ${rc}298 return ${rc}
299}299}
300300
301do_interactive_netmount() {
302 rc=1
303 if [ -x /bin/plymouth ] && plymouth --ping; then
304 plymouth hide-splash
305 sleep 1
306 fi
307 echo "Unable to find a medium container a live file system"
308 echo "Attempt interactive netboot from a URL?"
309 read -p "yes no (default yes): " RET
310 if [ "$RET" = "no" ]; then
311 return ${rc}
312 fi
313
314 # zdev
315 if type lszdev 2>/dev/null 1>/dev/null; then
316 echo "Available qeth devices:"
317 # shellcheck disable=SC2005 disable=SC2046
318 echo $(lszdev qeth --offline --columns id --no-headings | sed 's/:.*//') | fold -s -w 79
319 read -p "zdev to activate (comma separated, optional): " zdev
320 if [ -n "$zdev" ]; then
321 chzdev -e $zdev
322 fi
323 fi
324
325 # dhcp vs static
326 echo "Two methods available for IP configuration:"
327 echo " * static: for static IP configuration"
328 echo " * dhcp: for automatic IP configuration"
329 read -p "static dhcp (default 'dhcp'): " proto
330 # Yet support all the things linux kernel does
331 case $proto in
332 static|off|none)
333 proto=none
334 read -p "ip: " ip
335 read -p "gateway: " gateway
336 read -p "dns: " dns
337 ;;
338 dhcp|on|any|"")
339 proto=dhcp ;;
340 *)
341 echo invalid option ;;
342 esac
343
344 # vlan
345 read -p "vlan id (optional): " vlanid
346
347 # pick interface
348 interfaces=$(ls /sys/class/net | grep -v lo)
349 count=$(echo $interfaces | wc -w)
350 default_device=$(echo ${interfaces} | cut -d " " -f1)
351 if [ "$count" -gt 1 ]; then
352 if [ -n "$vlanid" ] || [ "$proto" = "none" ]; then
353 echo "Available interfaces:"
354 echo $interfaces | fold -s -w 79
355 read -p "device (default $default_device): " device
356 if [ -z "$device" ]; then
357 device=$default_device
358 fi
359 fi
360 fi
361
362 # url & proxy
363 ## todo set default
364 echo "Please specify URL to the .iso Examples:"
365 machine=$(uname -m)
366 case $machine in
367 x86_64) machine="amd64" ;;
368 ppc64le) machine="ppc64el" ;;
369 aarch64) machine="arm64" ;;
370 esac
371 case $machine in
372 amd64)
373 echo " https://releases.ubuntu.com/focal/ubuntu-20.04-live-server-$machine.iso"
374 echo " https://releases.ubuntu.com/focal/ubuntu-20.04-desktop-$machine.iso"
375 ;;
376 *)
377 echo " http://cdimage.ubuntu.com/releases/focal/release/ubuntu-20.04-live-server-$machine.iso"
378 ;;
379 esac
380 read -p "url: " url
381 if [ -z "$url" ]; then
382 echo "Must specify URL"
383 return ${rc}
384 fi
385 read -p "http_proxy (optional): " http_proxy
386 if [ -n "$http_proxy" ]; then
387 export http_proxy=$http_proxy
388 fi
389
390 if [ -n "$vlanid" ]; then
391 vlan=$device.$vlanid:$device
392 device=$device.$vlanid
393 export VLAN=$vlan
394 fi
395
396 echo Configuring networking...
397
398 export NETBOOT=url
399 export URL=$url
400 export VLAN=$vlan
401 export IP=$ip:$gateway:::$device:$proto:$dns
402 configure_networking
403 do_netmount
404}
405
301do_snap_copy ()406do_snap_copy ()
302{407{
303 fromdev="${1}"408 fromdev="${1}"
@@ -768,6 +873,12 @@ mountroot() {
768 sleep 1873 sleep 1
769 i="$(($i + 1))"874 i="$(($i + 1))"
770 done875 done
876
877 if [ -z "${livefs_root}" ]; then
878 if do_interactive_netmount ; then
879 livefs_root="${mountpoint}"
880 fi
881 fi
771 fi882 fi
772883
773 if [ -z "${livefs_root}" ]; then884 if [ -z "${livefs_root}" ]; then

Subscribers

People subscribed via source and target branches