github.com/coreos/rocket@v1.30.1-0.20200224141603-171c416fac02/scripts/install-rkt.sh (about)

     1  #!/bin/bash
     2  set -e
     3  set -x
     4  
     5  cd $(mktemp -d)
     6  
     7  version="1.30.0"
     8  
     9  export DEBIAN_FRONTEND=noninteractive
    10  
    11  apt-get update
    12  apt-get install -y --no-install-recommends \
    13          ca-certificates \
    14          gnupg2 \
    15          bash-completion \
    16          checkinstall \
    17          curl \
    18          iptables \
    19          wget
    20  
    21  curl -sSL https://coreos.com/dist/pubkeys/app-signing-pubkey.gpg | gpg2 --import -
    22  key=$(gpg2 --with-colons --keyid-format LONG -k security@coreos.com | egrep ^pub | cut -d ':' -f5)
    23  
    24  wget --progress=bar:force https://github.com/rkt/rkt/releases/download/v"${version}"/rkt-v"${version}".tar.gz
    25  wget --progress=bar:force https://github.com/rkt/rkt/releases/download/v"${version}"/rkt-v"${version}".tar.gz.asc
    26  gpg2 --trusted-key "${key}" --verify-files *.asc
    27  
    28  tar xvzf rkt-v"${version}".tar.gz
    29  
    30  cat <<EOF >install-pak
    31  #!/bin/bash
    32  
    33  # abort/fail on any error
    34  set -e
    35  
    36  # fix mkdir issues with checkinstall and fstrans
    37  for dir in /usr/lib/rkt/stage1-images/\\
    38          /usr/share/man/man1/\\
    39          /usr/share/bash-completion/completions/\\
    40          /usr/lib/tmpfiles.d/\\
    41          /usr/lib/systemd/system/
    42  do
    43      mkdir -p \$dir 2>/dev/null || :
    44  done
    45  
    46  for flavor in fly coreos kvm; do
    47      install -Dm644 rkt-v${version}/stage1-\${flavor}.aci /usr/lib/rkt/stage1-images/stage1-\${flavor}.aci
    48  done
    49  
    50  install -Dm755 rkt-v${version}/rkt /usr/bin/rkt
    51  
    52  for f in rkt-v${version}/manpages/*; do
    53      install -Dm644 "\${f}" "/usr/share/man/man1/\$(basename \$f)"
    54  done
    55  
    56  install -Dm644 rkt-v${version}/bash_completion/rkt.bash /usr/share/bash-completion/completions/rkt
    57  install -Dm644 rkt-v${version}/init/systemd/tmpfiles.d/rkt.conf /usr/lib/tmpfiles.d/rkt.conf
    58  
    59  for unit in rkt-gc.{timer,service} rkt-metadata.{socket,service}; do
    60      install -Dm644 rkt-v${version}/init/systemd/\$unit /usr/lib/systemd/system/\$unit
    61  done
    62  EOF
    63  chmod +x install-pak
    64  
    65  cat <<EOF >preinstall-pak
    66  #!/bin/sh
    67  
    68  groupadd --force --system rkt-admin
    69  groupadd --force --system rkt
    70  EOF
    71  chmod +x preinstall-pak
    72  
    73  cp rkt-v"${version}"/scripts/setup-data-dir.sh postinstall-pak
    74  chmod +x postinstall-pak
    75  
    76  cat <<EOF >>postinstall-pak
    77  systemctl daemon-reload
    78  systemd-tmpfiles --create /usr/lib/tmpfiles.d/rkt.conf
    79  EOF
    80  
    81  checkinstall -y --pkgname=rkt --pkgversion="${version}" ./install-pak