sh 使用checkinstall为Debian / Ubuntu创建rkt包

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用checkinstall为Debian / Ubuntu创建rkt包相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# Btased on https://github.com/coreos/rkt/blob/v1.15.0/scripts/install-rkt.sh
#
# Pre-requirement: install the packages:
# - ca-certificates
# - curl
# - gnupg2
# - bash-completion
# - checkinstall
# - wget
#
# Suggestion: sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg2 bash-completion checkinstall wget
#
# Then run this script as a normal user. In the final step, checkinstall will create the package in the location as shown in the output. Install as follows:
# sudo dpkg -i /path/to/the.deb

set -e
set -o pipefail
set -x

cd $(mktemp -d)

version="1.15.0"

export DEBIAN_FRONTEND=noninteractive

curl -sSL https://coreos.com/dist/pubkeys/app-signing-pubkey.gpg | gpg2 --import -
key=$(gpg2 --with-colons --keyid-format LONG -k security@coreos.com | egrep ^pub | cut -d ':' -f5)

wget --progress=bar:force https://github.com/coreos/rkt/releases/download/v"${version}"/rkt-v"${version}".tar.gz
wget --progress=bar:force https://github.com/coreos/rkt/releases/download/v"${version}"/rkt-v"${version}".tar.gz.asc
gpg2 --trusted-key "${key}" --verify-files *.asc

tar xvzf rkt-v"${version}".tar.gz

cat <<EOF >install-pak
#!/bin/bash

# abort/fail on any error
set -e

# fix mkdir issues with checkinstall and fstrans
for dir in /usr/lib/rkt/stage1-images/\\
        /usr/share/man/man1/\\
        /usr/share/bash-completion/completions/\\
        /usr/lib/tmpfiles.d/\\
        /usr/lib/systemd/system/
do
    mkdir -p \$dir 2>/dev/null || :
done

for flavor in fly coreos kvm; do
    install -Dm644 rkt-v${version}/stage1-\${flavor}.aci /usr/lib/rkt/stage1-images/stage1-\${flavor}.aci
done

install -Dm755 rkt-v${version}/rkt /usr/bin/rkt

for f in rkt-v${version}/manpages/*; do
    install -Dm644 "\${f}" "/usr/share/man/man1/\$(basename \$f)"
done

install -Dm644 rkt-v${version}/bash_completion/rkt.bash /usr/share/bash-completion/completions/rkt
install -Dm644 rkt-v${version}/init/systemd/tmpfiles.d/rkt.conf /usr/lib/tmpfiles.d/rkt.conf

for unit in rkt-gc.{timer,service} rkt-metadata.{socket,service}; do
    install -Dm644 rkt-v${version}/init/systemd/\$unit /usr/lib/systemd/system/\$unit
done
EOF
chmod +x install-pak

cat <<EOF >preinstall-pak
#!/bin/sh

groupadd --force --system rkt-admin
groupadd --force --system rkt
EOF
chmod +x preinstall-pak

cp rkt-v"${version}"/scripts/setup-data-dir.sh postinstall-pak
chmod +x postinstall-pak

cat <<EOF >>postinstall-pak
systemctl daemon-reload
systemd-tmpfiles --create /usr/lib/tmpfiles.d/rkt.conf
EOF

checkinstall -y --pkgname=rkt --pkgversion="${version}" --install=no --fstrans=yes ./install-pak

以上是关于sh 使用checkinstall为Debian / Ubuntu创建rkt包的主要内容,如果未能解决你的问题,请参考以下文章

sh 在一个命令中使用自定义补丁,配置和名称后缀为nginx构建Ubuntu或Debian软件包

如何从Linux源码创建RPM或DEB包

ubuntu上利用checkinstall制作deb或rpm包

sh 在debian上使用strongSwan建立安全的VPN

linux centos系统的sh文件改成debian系统的文件

sh 在Ubuntu / Debian中使用Gmail和msmtp发送电子邮件。