~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/kernel-install/90-loaderentry.install

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Michael Stapelberg, Daniel Schaal, Ondrej Balaz
  • Date: 2013-09-12 00:13:11 UTC
  • mfrom: (1.1.11) (9.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: package-import@ubuntu.com-20130912001311-dz35it34wr2lbday
Tags: 204-3
[ Michael Biebl ]
* Upload to unstable.
* Use /bin/bash in debug-shell.service as Debian doesn't have /sbin/sushell.
* Only import net.ifaces cmdline property for network devices.
* Generate strict dependencies between the binary packages using a
  shlibs.local file and add an explicit versioned dependency on
  libsystemd-login0 to systemd to ensure packages are upgraded in sync.
  Closes: #719444
* Drop obsolete Replaces: libudev0 from udev package.
* Use correct paths for various binaries, like /sbin/quotaon, which are
  installed in / and not /usr in Debian.  Closes: #721347
* Don't install kernel-install(8) man page since we don't install the
  corresponding binary either.  Closes: #722180
* Cherry-pick upstream fixes to make switching runlevels and starting
  reboot via ctrl-alt-del more robust.
* Cherry-pick upstream fix to properly apply ACLs to Journal files.

[ Michael Stapelberg ]
* Make systemctl enable|disable call update-rc.d for SysV init scripts.
  Closes: #709780
* Don't mount /tmp as tmpfs by default and make it possible to enable this
  feature via "systemctl enable tmp.mount".

[ Daniel Schaal ]
* Add bug-script to systemd and udev.  Closes: #711245

[ Ondrej Balaz ]
* Recognize discard option in /etc/crypttab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 
3
# ex: ts=8 sw=4 sts=4 et filetype=sh
 
4
 
 
5
COMMAND="$1"
 
6
KERNEL_VERSION="$2"
 
7
BOOT_DIR_ABS="$3"
 
8
KERNEL_IMAGE="$4"
 
9
 
 
10
if [[ -f /etc/machine-id ]]; then
 
11
    read MACHINE_ID < /etc/machine-id
 
12
fi
 
13
 
 
14
if ! [[ $MACHINE_ID ]]; then
 
15
    exit 1
 
16
fi
 
17
 
 
18
BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
 
19
LOADER_ENTRY="/boot/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
 
20
 
 
21
if [[ $COMMAND == remove ]]; then
 
22
    exec rm -f "$LOADER_ENTRY"
 
23
fi
 
24
 
 
25
if ! [[ $COMMAND == add ]]; then
 
26
    exit 1
 
27
fi
 
28
 
 
29
if ! [[ $KERNEL_IMAGE ]]; then
 
30
    exit 1
 
31
fi
 
32
 
 
33
if [[ -f /etc/os-release ]]; then
 
34
    . /etc/os-release
 
35
fi
 
36
 
 
37
if ! [[ $PRETTY_NAME ]]; then
 
38
    PRETTY_NAME="Linux $KERNEL_VERSION"
 
39
fi
 
40
 
 
41
if [[ -f /etc/kernel/cmdline ]]; then
 
42
    readarray -t BOOT_OPTIONS < /etc/kernel/cmdline
 
43
fi
 
44
 
 
45
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
 
46
    readarray -t BOOT_OPTIONS < /proc/cmdline
 
47
fi
 
48
 
 
49
if ! [[ $BOOT_OPTIONS ]]; then
 
50
    echo "Could not determine the kernel command line parameters." >&2
 
51
    echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
 
52
    exit 1
 
53
fi
 
54
 
 
55
cp --preserve "$KERNEL_IMAGE" "$BOOT_DIR_ABS/linux" || {
 
56
    echo "Could not copy '$KERNEL_IMAGE to '$BOOT_DIR_ABS/linux'." >&2
 
57
    exit 1
 
58
}
 
59
 
 
60
mkdir -p "${LOADER_ENTRY%/*}" || {
 
61
    echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
 
62
    exit 1
 
63
}
 
64
 
 
65
{
 
66
    echo "title      $PRETTY_NAME"
 
67
    echo "version    $KERNEL_VERSION"
 
68
    echo "machine-id $MACHINE_ID"
 
69
    echo "options    ${BOOT_OPTIONS[*]}"
 
70
    echo "linux      $BOOT_DIR/linux"
 
71
    [[ -f $BOOT_DIR_ABS/initrd ]] && \
 
72
        echo "initrd     $BOOT_DIR/initrd"
 
73
} > "$LOADER_ENTRY" || {
 
74
    echo "Could not create loader entry '$LOADER_ENTRY'." >&2
 
75
    exit 1
 
76
}
 
77
exit 0