~ubuntu-cdimage/debian-cd/ubuntu

  • Committer: Iain Lane
  • Date: 2020-12-01 11:17:30 UTC
  • Revision ID: iain.lane@canonical.com-20201201111730-oxsv7or8e72hvjww
common.sh: Use a proper "if" statement for ubuntu-canary in default_kernel_params()

In Bash (and POSIX shell), functions return the return code of the last
statement they executed if there's no other explicit return.

We have a function which ends with a statement like:

  [ $VAR = foo ] && do_something

When the first clause fails, the return code of this statement is 1. The
function returns 1 and, since we are running under set -e, the caller fails and
the script terminates.

Fix this by rewriting to use "if ... then ... fi" instead, which returns 0 if
the condition fails.

For information, note that there is a special case in the spec:

  The -e setting shall be ignored when executing [...] any command of an AND-OR
  list other than the last.

Which is why we terminate at the *caller* and not inside the function, and also
why this would work if we weren't inside a function. By being inside a
function, we effectively defeat this check.
Filename Latest Rev Last Changed Committer Comment Size
..
contrib 973 18 years ago Colin Watson merge from upstream up to patch-787 (Debian 2.2.22 Diff
data 30 19 years ago Arch Librarian Initial revision Author: aph Date: 1999-11-11 17:1 Diff
debian 30 19 years ago Arch Librarian Initial revision Author: aph Date: 1999-11-11 17:1 Diff
tasks 30 19 years ago Arch Librarian Initial revision Author: aph Date: 1999-11-11 17:1 Diff
tools 30 19 years ago Arch Librarian Initial revision Author: aph Date: 1999-11-11 17:1 Diff
.bzrignore 1082 18 years ago Colin Watson add ignores 113 bytes Diff Download File
.cvsignore 96 19 years ago Arch Librarian * Copy pics/*.jpg instead of pics/*. Author: hertz 30 bytes Diff Download File
File build.sh 1608 13 years ago Colin Watson Backport from upstream (Frans Pop): Add path whe 1.9 KB Diff Download File
File build_all.sh 2061.1.2 3 years ago Dimitri John Ledkov Drop imagesums for source isos too. Unused. 3.6 KB Diff Download File
CONF.sh 2099 3 years ago Iain Lane CONF.sh: Use distro's xorriso for hirsute 21.9 KB Diff Download File
File Makefile 2074 3 years ago Iain Lane Makefile: Make keyrings from /usr/share/keyrings/ 46.3 KB Diff Download File
README 1387.1.1 15 years ago Loic Minier replace CDIMAGE_VFAT= with IMAGE_FORMAT= (either v 13.8 KB Diff Download File
README.devel 310 19 years ago Arch Librarian * Removed el-torito multiboot support. Author: her 2.8 KB Diff Download File
File update-cd 839 19 years ago Colin Watson use $CDIMAGE_ROOT rather than hardcoding /srv/cdim 6.1 KB Diff Download File