source: /cluster/svnroot/bccd-ng/branches/skylar/bccd-3.4.0-build_ng/bin/bccd_install_pkgs @ 6051

Last change on this file since 6051 was 6051, checked in by skylar, 2 years ago

only install BCCD_PACKAGES if NO_BCCD is not set re #1008, #1009

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#!/usr/bin/env bash
2
3# $Id: bccd_install_pkgs 6051 2018-07-08 22:50:47Z skylar $
4
5set -eo pipefail
6
7function cleanup() {
8    # Unmount virtual filesystems if it mounted
9    for dir in {proc,sys}; do
10        if /bin/mount|/bin/egrep -q "${WORKSPACE}/debootstrap/${dir}"; then
11            /usr/bin/sudo /bin/umount "${WORKSPACE}/debootstrap/${dir}"
12        fi
13    done
14}
15
16. "${WORKSPACE}"/bccd.conf
17# Get PACKAGES array
18. "${WORKSPACE}"/packages.conf
19
20trap 'cleanup' INT TERM EXIT ERR
21
22# gnupg2 is required for apt-key
23/usr/bin/sudo DEBIAN_FRONTEND=noninteractive /usr/sbin/chroot "${WORKSPACE}/debootstrap" apt-get \
24    -o Dpkg::Options::="--force-confnew" \
25    -y install \
26    gnupg2
27
28# Option to disable bccd deb install (#1008)
29if [[ -z ${NO_BCCD} ]]; then
30    /usr/bin/sudo WORKSPACE="${WORKSPACE}" /usr/sbin/chroot "${WORKSPACE}/debootstrap" /usr/bin/dpkg --force-confnew -i /tmp/bccd.noarch.deb
31fi
32
33/usr/bin/sudo /usr/sbin/chroot "${WORKSPACE}/debootstrap" apt-get update
34/usr/bin/sudo DEBIAN_FRONTEND=noninteractive /usr/sbin/chroot "${WORKSPACE}/debootstrap" apt-get \
35    -o Dpkg::Options::="--force-confnew" \
36    -y install \
37    ${PACKAGES[@]}
38
39# Only install BCCD packages if NO_BCCD is not set re #1008, #1009
40if [[ -z ${NO_BCCD} ]]; then
41    /usr/bin/sudo DEBIAN_FRONTEND=noninteractive /usr/sbin/chroot "${WORKSPACE}/debootstrap" apt-get \
42        -o Dpkg::Options::="--force-confnew" \
43        -y install \
44        ${BCCD_PACKAGES[@]}
45fi
46
47# Installing grub w/ linux-image triggers errors if /dev is not mounted, but is not necessary until liberation
48/usr/bin/sudo DEBIAN_FRONTEND=noninteractive /usr/sbin/chroot "${WORKSPACE}/debootstrap" apt-get \
49    -o Dpkg::Options::="--force-confnew" \
50    -y install \
51    grub-legacy
52
53# Clean up and regenerate SSH keys (#993)
54echo "Removing SSH keys in ${WORKSPACE}/debootstrap/etc/ssh" >&2
55/usr/bin/sudo /usr/sbin/chroot "${WORKSPACE}/debootstrap" /usr/bin/find /etc/ssh -type f -name 'ssh*host*key*' -delete -print
56
57# Clean up apt cache (#998)
58echo "Cleaning apt cache" >&2
59/usr/bin/sudo /usr/sbin/chroot "${WORKSPACE}/debootstrap" /usr/bin/apt-get clean
Note: See TracBrowser for help on using the repository browser.