diff options
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/cirrus/pr-removes-fixed-skips | 193 | ||||
-rwxr-xr-x | contrib/cirrus/pr-removes-fixed-skips.t | 134 | ||||
-rwxr-xr-x | contrib/cirrus/runner.sh | 8 | ||||
-rwxr-xr-x | contrib/cirrus/setup_environment.sh | 46 | ||||
-rw-r--r-- | contrib/pkginstaller/.gitignore | 6 | ||||
-rw-r--r-- | contrib/pkginstaller/Distribution.in | 17 | ||||
-rw-r--r-- | contrib/pkginstaller/Makefile | 50 | ||||
-rw-r--r-- | contrib/pkginstaller/README.md | 22 | ||||
-rw-r--r-- | contrib/pkginstaller/Resources/banner.png | bin | 0 -> 50381 bytes | |||
-rw-r--r-- | contrib/pkginstaller/Resources/conclusion.html | 13 | ||||
-rwxr-xr-x | contrib/pkginstaller/package.sh | 60 | ||||
-rwxr-xr-x | contrib/pkginstaller/scripts/postinstall | 27 | ||||
-rwxr-xr-x | contrib/pkginstaller/scripts/preinstall | 5 | ||||
-rw-r--r-- | contrib/pkginstaller/welcome.html.in | 16 |
14 files changed, 579 insertions, 18 deletions
diff --git a/contrib/cirrus/pr-removes-fixed-skips b/contrib/cirrus/pr-removes-fixed-skips new file mode 100755 index 000000000..c4acf6e06 --- /dev/null +++ b/contrib/cirrus/pr-removes-fixed-skips @@ -0,0 +1,193 @@ +#!/usr/bin/perl +# +# pr-removes-fixed-skips - if PR says "Fixes: #123", no skips should mention 123 +# +package Podman::CI::PrRemovesFixedSkips; + +use v5.14; +use utf8; + +# Grumble. CI system doesn't have 'open' +binmode STDIN, ':utf8'; +binmode STDOUT, ':utf8'; + +use strict; +use warnings; + +(our $ME = $0) =~ s|.*/||; +our $VERSION = '0.1'; + +############################################################################### +# BEGIN boilerplate args checking, usage messages + +sub usage { + print <<"END_USAGE"; +Usage: $ME [OPTIONS] + +$ME reads a GitHub PR message, looks for +Fixed/Resolved/Closed issue IDs, then greps for test files +containing 'Skip' instructions or FIXME comments referencing +those IDs. If we find any, we abort with a loud and hopefully +useful message. + +$ME is intended to run from Cirrus CI. + +OPTIONS: + + --help display this message + --version display program name and version +END_USAGE + + exit; +} + +# Command-line options. Note that this operates directly on @ARGV ! +our $debug = 0; +sub handle_opts { + use Getopt::Long; + GetOptions( + 'debug!' => \$debug, + + help => \&usage, + version => sub { print "$ME version $VERSION\n"; exit 0 }, + ) or die "Try `$ME --help' for help\n"; +} + +# END boilerplate args checking, usage messages +############################################################################### + +############################## CODE BEGINS HERE ############################### + +# The term is "modulino". +__PACKAGE__->main() unless caller(); + +# Main code. +sub main { + # Note that we operate directly on @ARGV, not on function parameters. + # This is deliberate: it's because Getopt::Long only operates on @ARGV + # and there's no clean way to make it use @_. + handle_opts(); # will set package globals + + die "$ME: This script takes no arguments; try $ME --help\n" if @ARGV; + + # Check commit messages from both github and git; they often differ + my @issues = fixed_issues(cirrus_change_message(), git_commit_messages()) + or exit 0; + + my @found = unremoved_skips(@issues) + or exit 0; + + # Found unremoved skips. Fail loudly. + my $issues = "issue #$issues[0]"; + if (@issues > 1) { + $issues = "issues #" . join ", #", @issues; + } + + warn "$ME: Your PR claims to resolve $issues\n"; + warn " ...but does not remove associated Skips/FIXMEs:\n"; + warn "\n"; + warn " $_\n" for @found; + warn "\n"; + warn <<"END_ADVICE"; +Please do not leave Skips or FIXMEs for closed issues. + +If an issue is truly fixed, please remove all Skips referencing it. + +If an issue is only PARTIALLY fixed, please file a new issue for the +remaining problem, and update remaining Skips to point to that issue. + +And if the issue is fixed but the Skip needs to remain for other +reasons, again, please update the Skip message accordingly. +END_ADVICE + exit 1; +} + +##################### +# unremoved_skips # Returns list of <path>:<lineno>:<skip string> matches +##################### +sub unremoved_skips { + my $issues = join('|', @_); + + my $re = "(^\\s\+skip|fixme).*#($issues)[^0-9]"; + # FIXME FIXME FIXME: use File::Find instead of enumerating directories + # (the important thing here is to exclude vendor) + my @grep = ('egrep', '-rin', $re, "test", "cmd", "libpod", "pkg"); + + my @skips; + open my $grep_fh, '-|', @grep + or die "$ME: Could not fork: $!\n"; + while (my $line = <$grep_fh>) { + chomp $line; + + # e.g., test/system/030-run.bats:809: skip "FIXME: #12345 ..." + $line =~ m!^(\S+):\d+:\s! + or die "$ME: Internal error: output from grep does not match <path>:<lineno>:<space>: '$line'"; + my $path = $1; + + # Any .go or .bats file, or the apply-podman-deltas script + if ($path =~ /\.(go|bats)$/ || $path =~ m!/apply-podman-deltas$!) { + push @skips, $line; + } + + # Anything else is probably a backup file, or something else + # we don't care about. (We won't see these in CI, but might + # in a user devel environment) + elsif ($debug) { + print "[ ignoring: $line ]\n"; + } + } + close $grep_fh; + + return sort @skips; +} + +################## +# fixed_issues # Parses change message, looks for Fixes/Closes/Resolves +################## +sub fixed_issues { + my @issues; + + for my $msg (@_) { + # https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword + # + # 1 1 2 2 + while ($msg =~ /\b(Fix|Clos|Resolv)[esd]*[:\s]+\#(\d+)/gis) { + # Skip dups: we're probably checking both github and git messages + push @issues, $2 + unless grep { $_ eq $2 } @issues; + } + } + + return @issues; +} + +########################### +# cirrus_change_message # this is the one from *GitHub*, not *git* +########################### +sub cirrus_change_message { + my $change_message = $ENV{CIRRUS_CHANGE_MESSAGE} + or do { + # OK for it to be unset if we're not running CI on a PR + return if ! $ENV{CIRRUS_PR}; + # But if we _are_ running on a PR, something went badly wrong. + die "$ME: \$CIRRUS_CHANGE_MESSAGE is undefined\n"; + }; + + return $change_message; +} + +######################### +# git_commit_messages # the ones from the *git history* +######################### +sub git_commit_messages { + # Probably the same as HEAD, but use Cirrus-defined value if available + my $head = $ENV{CIRRUS_CHANGE_IN_REPO} || 'HEAD'; + + # Base of this PR. Here we absolutely rely on cirrus. + return if ! $ENV{DEST_BRANCH}; + chomp(my $base = qx{git merge-base $ENV{DEST_BRANCH} $head}); + + qx{git log --format=%B $base..$head}; +} + +1; diff --git a/contrib/cirrus/pr-removes-fixed-skips.t b/contrib/cirrus/pr-removes-fixed-skips.t new file mode 100755 index 000000000..c936892cd --- /dev/null +++ b/contrib/cirrus/pr-removes-fixed-skips.t @@ -0,0 +1,134 @@ +#!/usr/bin/perl -w + +# Don't care if these modules don't exist in CI; only Ed runs this test +use v5.14; +use Test::More; +use Test::Differences; +use File::Basename; +use File::Path qw(make_path remove_tree); +use File::Temp qw(tempdir); +use FindBin; + +# Simpleminded parser tests. LHS gets glommed together into one long +# github message; RHS (when present) is the expected subset of issue IDs +# that will be parsed from it. +# +# Again, we glom the LHS into one long multiline string. There doesn't +# seem to be much point to testing line-by-line. +my $parser_tests = <<'END_PARSER_TESTS'; +Fixes 100 +Fixes: 101 +Closes 102 + +Fixes: #103 | 103 +Fix: #104, #105 | 104 +Resolves: #106 closes #107 | 106 107 + +fix: #108, FIXES: #109, FiXeD: #110 | 108 109 110 +Close: #111 resolved: #112 | 111 112 +END_PARSER_TESTS + + +# Read tests from __END__ section of this script +my @full_tests; +while (my $line = <DATA>) { + chomp $line; + + if ($line =~ /^==\s+(.*)/) { + push @full_tests, + { name => $1, issues => [], files => {}, expect => [] }; + } + elsif ($line =~ /^\[([\d\s,]+)\]$/) { + $full_tests[-1]{issues} = [ split /,\s+/, $1 ]; + } + + # 1 1 23 3 4 4 5 52 + elsif ($line =~ m!^(\!|\+)\s+((\S+):(\d+):(.*))$!) { + push @{$full_tests[-1]{expect}}, $2 if $1 eq '+'; + + $full_tests[-1]{files}{$3}[$4] = $5; + } +} + +plan tests => 1 + 1 + @full_tests; + +require_ok "$FindBin::Bin/pr-removes-fixed-skips"; + +# +# Parser tests. Just run as one test. +# +my $msg = ''; +my @parser_expect; +for my $line (split "\n", $parser_tests) { + if ($line =~ s/\s+\|\s+([\d\s]+)$//) { + push @parser_expect, split ' ', $1; + } + $msg .= $line . "\n"; +} + +my @parsed = Podman::CI::PrRemovesFixedSkips::fixed_issues($msg); +eq_or_diff \@parsed, \@parser_expect, "parser parses issue IDs"; + +############################################################################### + +# +# Full tests. Create dummy source-code trees and verify that our check runs. +# +my $tmpdir = tempdir(basename($0) . ".XXXXXXXX", TMPDIR => 1, CLEANUP => 1); +chdir $tmpdir + or die "Cannot cd $tmpdir: $!"; +mkdir $_ for qw(cmd libpod pkg test); +for my $t (@full_tests) { + for my $f (sort keys %{$t->{files}}) { + my $lineno = 0; + make_path(dirname($f)); + open my $fh, '>', $f or die; + + my @lines = @{$t->{files}{$f}}; + for my $i (1 .. @lines + 10) { + my $line = $lines[$i] || "[line $i intentionally left blank]"; + print { $fh } $line, "\n"; + } + close $fh + or die; + } + + # FIXME: run test + my @actual = Podman::CI::PrRemovesFixedSkips::unremoved_skips(@{$t->{issues}}); + eq_or_diff \@actual, $t->{expect}, $t->{name}; + + # clean up + unlink $_ for sort keys %{$t->{files}}; +} + +chdir '/'; + +__END__ + +== basic test +[12345] +! test/foo/bar/foo.bar:10: skip "#12345: not a .go file" ++ test/foo/bar/foo.go:17: skip "#12345: this one should be found" ++ test/zzz/foo.bats:10: # FIXME: #12345: we detect FIXMEs also + +== no substring matches +[123] +! test/system/123-foo.bats:12: skip "#1234: should not match 123" +! test/system/123-foo.bats:13: skip "#0123: should not match 123" + +== multiple matches +[456, 789] ++ cmd/podman/foo_test.go:10: Skip("#456 - blah blah") +! cmd/podman/foo_test.go:15: Skip("#567 - not a match") ++ cmd/podman/foo_test.go:19: Skip("#789 - match 2nd issue") ++ cmd/podman/zzz_test.go:12: Skip("#789 - in another file") + +== no match on bkp files +[10101] +! pkg/podman/foo_test.go~:10: Skip("#10101: no match in ~ file") +! pkg/podman/foo_test.go.bkp:10: Skip("#10101: no match in .bkp file") + +== no match if Skip is commented out +[123] +! test/e2e/foo_test.go:10: // Skip("#123: commented out") +! test/system/012-foo.bats:20: # skip "#123: commented out" diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh index 32f66bac2..35ecfd4ff 100755 --- a/contrib/cirrus/runner.sh +++ b/contrib/cirrus/runner.sh @@ -35,6 +35,10 @@ function _run_automation() { } function _run_validate() { + # TODO: aarch64 images need python3-devel installed + # https://github.com/containers/automation_images/issues/159 + bigto ooe.sh dnf install -y python3-devel + # git-validation tool fails if $EPOCH_TEST_COMMIT is empty # shellcheck disable=SC2154 if [[ -n "$EPOCH_TEST_COMMIT" ]]; then @@ -246,6 +250,7 @@ function _run_build() { if [[ "$runtime" != "$CI_DESIRED_RUNTIME" ]]; then die "Built podman is using '$runtime'; this CI environment requires $CI_DESIRED_RUNTIME" fi + msg "Built podman is using expected runtime='$runtime'" } function _run_altbuild() { @@ -334,6 +339,9 @@ function _run_release() { } +# ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING*** +# Please see gitlab comment in setup_environment.sh +# ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING*** function _run_gitlab() { rootless_uid=$(id -u) systemctl enable --now --user podman.socket diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh index 4952f8dd2..c3b7811bc 100755 --- a/contrib/cirrus/setup_environment.sh +++ b/contrib/cirrus/setup_environment.sh @@ -71,27 +71,20 @@ fi cd "${GOSRC}/" -# Defined by lib.sh: Does the host support cgroups v1 or v2 +# Defined by lib.sh: Does the host support cgroups v1 or v2? Use runc or crun +# respectively. +# **IMPORTANT**: $OCI_RUNTIME is a fakeout! It is used only in e2e tests. +# For actual podman, as in system tests, we force runtime in containers.conf case "$CG_FS_TYPE" in tmpfs) if ((CONTAINER==0)); then warn "Forcing testing with runc instead of crun" - if [[ "$OS_RELEASE_ID" == "ubuntu" ]]; then - # Need b/c using cri-o-runc package from OBS - echo "OCI_RUNTIME=/usr/lib/cri-o-runc/sbin/runc" \ - >> /etc/ci_environment - else - echo "OCI_RUNTIME=runc" >> /etc/ci_environment - fi + echo "OCI_RUNTIME=runc" >> /etc/ci_environment + printf "[engine]\nruntime=\"runc\"\n" >>/etc/containers/containers.conf fi ;; cgroup2fs) - if ((CONTAINER==0)); then - # This is necessary since we've built/installed from source, - # which uses runc as the default. - warn "Forcing testing with crun instead of runc" - echo "OCI_RUNTIME=crun" >> /etc/ci_environment - fi + # Nothing to do: podman defaults to crun ;; *) die_unknown CG_FS_TYPE esac @@ -321,13 +314,30 @@ case "$TEST_FLAVOR" in install_test_configs ;; gitlab) - # This only runs on Ubuntu for now + # ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING*** + # This sets up a special ubuntu environment exclusively for + # running the upstream gitlab-runner unit tests through + # podman as a drop-in replacement for the Docker daemon. + # Test and setup information can be found here: + # https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27270#note_499585550 + # + # Unless you know what you're doing, and/or are in contact + # with the upstream gitlab-runner developers/community, + # please don't make changes willy-nilly to this setup. + # It's designed to follow upstream gitlab-runner development + # and alert us if any podman change breaks their foundation. + # + # That said, if this task does break in strange ways or requires + # updates you're unsure of. Please consult with the upstream + # community through an issue near the one linked above. If + # an extended period of breakage is expected, please un-comment + # the related `allow_failures: $CI == $CI` line in `.cirrus.yml`. + # ***WARNING*** ***WARNING*** ***WARNING*** ***WARNING*** + if [[ "$OS_RELEASE_ID" != "ubuntu" ]]; then die "This test only runs on Ubuntu due to sheer laziness" fi - # Ref: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27270#note_499585550 - remove_packaged_podman_files make install PREFIX=/usr ETCDIR=/etc @@ -351,7 +361,7 @@ case "$TEST_FLAVOR" in slug="gitlab.com/gitlab-org/gitlab-runner" helper_fqin="registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest-pwsh" ssh="ssh $ROOTLESS_USER@localhost -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no env GOPATH=$GOPATH" - showrun $ssh go get -u github.com/jstemmer/go-junit-report + showrun $ssh go install github.com/jstemmer/go-junit-report/v2@v2.0.0 showrun $ssh git clone https://$slug $GOPATH/src/$slug showrun $ssh make -C $GOPATH/src/$slug development_setup showrun $ssh bash -c "'cd $GOPATH/src/$slug && GOPATH=$GOPATH go get .'" diff --git a/contrib/pkginstaller/.gitignore b/contrib/pkginstaller/.gitignore new file mode 100644 index 000000000..5e597ab07 --- /dev/null +++ b/contrib/pkginstaller/.gitignore @@ -0,0 +1,6 @@ +out +Distribution +welcome.html +tmp-download +.vscode +root diff --git a/contrib/pkginstaller/Distribution.in b/contrib/pkginstaller/Distribution.in new file mode 100644 index 000000000..0e0d3843a --- /dev/null +++ b/contrib/pkginstaller/Distribution.in @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<installer-script minSpecVersion="1.000000"> + <title>Podman __VERSION__</title> + <background mime-type="image/png" file="banner.png" scaling="proportional"/> + <welcome file="welcome.html" mime-type="text/html" /> + <conclusion file="conclusion.html" mime-type="text/html" /> + <license file="LICENSE.txt"/> + <options customize="never" hostArchitectures="x86_64,arm64" /> + <domains enable_localSystem="true" /> + <choices-outline> + <line choice="podman"/> + </choices-outline> + <choice id="podman" title="podman"> + <pkg-ref id="podman.pkg"/> + </choice> + <pkg-ref id="podman.pkg">podman.pkg</pkg-ref> +</installer-script> diff --git a/contrib/pkginstaller/Makefile b/contrib/pkginstaller/Makefile new file mode 100644 index 000000000..19c9b51aa --- /dev/null +++ b/contrib/pkginstaller/Makefile @@ -0,0 +1,50 @@ +SHELL := bash + +ARCH ?= aarch64 +PODMAN_VERSION ?= 4.1.0 +GVPROXY_VERSION ?= 0.4.0 +QEMU_VERSION ?= 7.0.0-2 +GVPROXY_RELEASE_URL ?= https://github.com/containers/gvisor-tap-vsock/releases/download/v$(GVPROXY_VERSION)/gvproxy-darwin +QEMU_RELEASE_URL ?= https://github.com/containers/podman-machine-qemu/releases/download/v$(QEMU_VERSION)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz +PACKAGE_DIR ?= out/packaging +TMP_DOWNLOAD ?= tmp-download +PACKAGE_ROOT ?= root + +default: pkginstaller + +get_gvproxy: + mkdir -p $(TMP_DOWNLOAD) + cd $(TMP_DOWNLOAD) && curl -sLo gvproxy $(GVPROXY_RELEASE_URL) + +get_qemu: + mkdir -p $(TMP_DOWNLOAD) + cd $(TMP_DOWNLOAD) && curl -sLO $(QEMU_RELEASE_URL) + +packagedir: package_root Distribution welcome.html + mkdir -p $(PACKAGE_DIR) + cp -r Resources $(PACKAGE_DIR)/ + cp welcome.html $(PACKAGE_DIR)/Resources/ + cp Distribution $(PACKAGE_DIR)/ + cp -r scripts $(PACKAGE_DIR)/ + cp -r $(PACKAGE_ROOT) $(PACKAGE_DIR)/ + cp package.sh $(PACKAGE_DIR)/ + cd $(PACKAGE_DIR) && pkgbuild --analyze --root ./root component.plist + echo -n $(PODMAN_VERSION) > $(PACKAGE_DIR)/VERSION + echo -n $(ARCH) > $(PACKAGE_DIR)/ARCH + cp ../../LICENSE $(PACKAGE_DIR)/Resources/LICENSE.txt + +package_root: get_gvproxy get_qemu + mkdir -p $(PACKAGE_ROOT)/podman/bin $(PACKAGE_ROOT)/podman/qemu + tar -C $(PACKAGE_ROOT)/podman/qemu -xf $(TMP_DOWNLOAD)/podman-machine-qemu-$(ARCH)-$(QEMU_VERSION).tar.xz + cp $(TMP_DOWNLOAD)/gvproxy $(PACKAGE_ROOT)/podman/bin/ + chmod a+x $(PACKAGE_ROOT)/podman/bin/* + +%: %.in + @sed -e 's/__VERSION__/'$(PODMAN_VERSION)'/g' $< >$@ + +pkginstaller: packagedir + cd $(PACKAGE_DIR) && ./package.sh .. + +.PHONY: clean +clean: + rm -rf $(TMP_DOWNLOAD) $(PACKAGE_ROOT) $(PACKAGE_DIR) Distribution welcome.html diff --git a/contrib/pkginstaller/README.md b/contrib/pkginstaller/README.md new file mode 100644 index 000000000..37c59ce04 --- /dev/null +++ b/contrib/pkginstaller/README.md @@ -0,0 +1,22 @@ +## How to build + +```sh +$ make ARCH=<amd64 | aarch64> NO_CODESIGN=1 pkginstaller + +# or to create signed pkg +$ make ARCH=<amd64 | aarch64> CODESIGN_IDENTITY=<ID> PRODUCTSIGN_IDENTITY=<ID> pkginstaller +``` + +The generated pkg will be written to `out/podman-macos-installer-*.pkg`. +Currently the pkg installs `podman`, `qemu`, `gvproxy` and `podman-mac-helper` to `/Applications/podman` + +The `qemu` build it uses is from [containers/podman-machine-qemu](https://github.com/containers/podman-machine-qemu) + +## Uninstalling + +```sh +$ sudo rm -rf /opt/podman +``` + +### Screenshot +<img width="626" alt="screenshot-macOS-pkg-podman" src="https://user-images.githubusercontent.com/8885742/157380992-2e3b1573-34a0-4aa0-bdc1-a85f4792a1d2.png"> diff --git a/contrib/pkginstaller/Resources/banner.png b/contrib/pkginstaller/Resources/banner.png Binary files differnew file mode 100644 index 000000000..7db751341 --- /dev/null +++ b/contrib/pkginstaller/Resources/banner.png diff --git a/contrib/pkginstaller/Resources/conclusion.html b/contrib/pkginstaller/Resources/conclusion.html new file mode 100644 index 000000000..c442e4ebf --- /dev/null +++ b/contrib/pkginstaller/Resources/conclusion.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"/> +</head> +<body> +<div align="left" style="font-family: Helvetica; padding-left: 10px;"> + <br/> + <p style="color: #020202; font-size: 12px;">Thanks for installing Podman!</p> + <p style="color: #020202; font-size: 12px;">You can now start using the 'podman' command. First run 'podman machine init'</b>.</p> +</div> +</body> +</html> diff --git a/contrib/pkginstaller/package.sh b/contrib/pkginstaller/package.sh new file mode 100755 index 000000000..b7b33954d --- /dev/null +++ b/contrib/pkginstaller/package.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -euxo pipefail + +BASEDIR=$(dirname "$0") +OUTPUT=$1 +CODESIGN_IDENTITY=${CODESIGN_IDENTITY:-mock} +PRODUCTSIGN_IDENTITY=${PRODUCTSIGN_IDENTITY:-mock} +NO_CODESIGN=${NO_CODESIGN:-0} +HELPER_BINARIES_DIR="/opt/podman/qemu/bin" + +binDir="${BASEDIR}/root/podman/bin" + +function build_podman() { + pushd "$1" + make podman-remote HELPER_BINARIES_DIR="${HELPER_BINARIES_DIR}" + make podman-mac-helper + cp bin/darwin/podman "contrib/pkginstaller/out/packaging/${binDir}/podman" + cp bin/darwin/podman-mac-helper "contrib/pkginstaller/out/packaging/${binDir}/podman-mac-helper" + popd +} + +function sign() { + if [ "${NO_CODESIGN}" -eq "1" ]; then + return + fi + local opts="" + entitlements="${BASEDIR}/$(basename "$1").entitlements" + if [ -f "${entitlements}" ]; then + opts="--entitlements ${entitlements}" + fi + codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --force --timestamp "${opts}" "$1" +} + +version=$(cat "${BASEDIR}/VERSION") +arch=$(cat "${BASEDIR}/ARCH") + +build_podman "../../../../" +sign "${binDir}/podman" +sign "${binDir}/gvproxy" +sign "${binDir}/podman-mac-helper" + +pkgbuild --identifier com.redhat.podman --version "${version}" \ + --scripts "${BASEDIR}/scripts" \ + --root "${BASEDIR}/root" \ + --install-location /opt \ + --component-plist "${BASEDIR}/component.plist" \ + "${OUTPUT}/podman.pkg" + +productbuild --distribution "${BASEDIR}/Distribution" \ + --resources "${BASEDIR}/Resources" \ + --package-path "${OUTPUT}" \ + "${OUTPUT}/podman-unsigned.pkg" +rm "${OUTPUT}/podman.pkg" + +if [ ! "${NO_CODESIGN}" -eq "1" ]; then + productsign --timestamp --sign "${PRODUCTSIGN_IDENTITY}" "${OUTPUT}/podman-unsigned.pkg" "${OUTPUT}/podman-installer-macos-${arch}.pkg" +else + mv "${OUTPUT}/podman-unsigned.pkg" "${OUTPUT}/podman-installer-macos-${arch}.pkg" +fi diff --git a/contrib/pkginstaller/scripts/postinstall b/contrib/pkginstaller/scripts/postinstall new file mode 100755 index 000000000..db17eede8 --- /dev/null +++ b/contrib/pkginstaller/scripts/postinstall @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e + +BZSH_PODMAN_PATH_EXP='PATH="/opt/podman/bin:$PATH"' +FISH_PODMAN_PATH_EXP='set PATH "/opt/podman/bin $PATH"' +BASHRC_PATH="$HOME/.bash_profile" +ZSHENV_PATH="$HOME/.zshenv" +ZSHRC_PATH="$HOME/.zshrc" +FSHCFG_PATH="$HOME/.config/fish/config.fish" + +# append /Applications/podman/bin to $PATH +if [ -f "$BASHRC_PATH" ]; then + grep -Fxq "$BZSH_PODMAN_PATH_EXP" "$BASHRC_PATH" || echo "$BZSH_PODMAN_PATH_EXP" >> "$BASHRC_PATH" +fi +if [ -f "$ZSHENV_PATH" ]; then + grep -Fxq "$BZSH_PODMAN_PATH_EXP" "$ZSHENV_PATH" || echo "$BZSH_PODMAN_PATH_EXP" >> "$ZSHENV_PATH" +fi +if [ -f "$ZSHRC_PATH" ]; then + grep -Fxq "$BZSH_PODMAN_PATH_EXP" "$ZSHRC_PATH" || echo "$BZSH_PODMAN_PATH_EXP" >> "$ZSHRC_PATH" +fi +if [ -f "$FSHCFG_PATH" ]; then + grep -Fxq "$FISH_PODMAN_PATH_EXP" "$FSHCFG_PATH" || echo "$FISH_PODMAN_PATH_EXP" >> "$FSHCFG_PATH" +fi + +ln -s /opt/podman/bin/podman-mac-helper /opt/podman/qemu/bin/podman-mac-helper +ln -s /opt/podman/bin/gvproxy /opt/podman/qemu/bin/gvproxy diff --git a/contrib/pkginstaller/scripts/preinstall b/contrib/pkginstaller/scripts/preinstall new file mode 100755 index 000000000..a381868fc --- /dev/null +++ b/contrib/pkginstaller/scripts/preinstall @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +rm -rf /opt/podman diff --git a/contrib/pkginstaller/welcome.html.in b/contrib/pkginstaller/welcome.html.in new file mode 100644 index 000000000..b06198716 --- /dev/null +++ b/contrib/pkginstaller/welcome.html.in @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"/> +</head> +<body> +<div align="left" style="font-family: Helvetica; padding-left: 10px;"> + <br/> + <p style="color: #020202; font-size: 12px;">This will install <span style="color: #46b9d6; font-size: 12px;">Podman __VERSION__</span> + on your computer. You will be guided through the steps necessary to install this software.</p> + <br/> + <p style="color: #abb0b0; font-size: 12px;">Click <span style="color: #626666">“Continue"</span> to continue the + setup</p> +</div> +</body> +</html> |