From 77bd31dbd06741e9d14f5ca96b1a09177e540d29 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Wed, 29 May 2024 14:50:12 +0700 Subject: [PATCH 1/3] Add s6-permafailon directive --- lib/pakman/bootstrap.ex | 4 ++++ lib/pakman/bootstrap/templates.ex | 9 +++++++++ lib/pakman/bootstrap/templates/apkbuild.eex | 2 ++ lib/pakman/bootstrap/templates/finish.eex | 2 ++ 4 files changed, 17 insertions(+) create mode 100644 lib/pakman/bootstrap/templates/finish.eex diff --git a/lib/pakman/bootstrap.ex b/lib/pakman/bootstrap.ex index 54d9701..fe69211 100644 --- a/lib/pakman/bootstrap.ex +++ b/lib/pakman/bootstrap.ex @@ -148,6 +148,10 @@ defmodule Pakman.Bootstrap do |> Path.join() |> File.write!(Templates.run(configuration)) + [base_path, "#{name}.finish"] + |> Path.join() + |> File.write!(Templates.finish(configuration)) + [base_path, "#{name}.log"] |> Path.join() |> File.write!(Templates.log(name)) diff --git a/lib/pakman/bootstrap/templates.ex b/lib/pakman/bootstrap/templates.ex index de1e6f7..0975d21 100644 --- a/lib/pakman/bootstrap/templates.ex +++ b/lib/pakman/bootstrap/templates.ex @@ -62,6 +62,15 @@ defmodule Pakman.Bootstrap.Templates do ] ) + EEx.function_from_file( + :def, + :finish, + Path.join(@prefix, "finish.eex"), + [ + :configuration + ] + ) + EEx.function_from_file( :def, :pre_install, diff --git a/lib/pakman/bootstrap/templates/apkbuild.eex b/lib/pakman/bootstrap/templates/apkbuild.eex index 811e63d..e561cbf 100644 --- a/lib/pakman/bootstrap/templates/apkbuild.eex +++ b/lib/pakman/bootstrap/templates/apkbuild.eex @@ -30,6 +30,7 @@ source=" <%= if configuration["type"] not in ["static", "custom"] do %> $pkgname.initd $pkgname.run + $pkgname.finish $pkgname.log $pkgname.environment $pkgname.env-exec @@ -73,6 +74,7 @@ package() { <% else %> install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname install -Dm755 "$srcdir"/$pkgname.run "$pkgdir"/var/lib/$pkgname/service/run + install -Dm755 "$srcdir"/$pkgname.finish "$pkgdir"/var/lib/$pkgname/service/finish install -Dm755 "$srcdir"/$pkgname.log "$pkgdir"/var/lib/$pkgname/service/log/run install -Dm755 "$srcdir"/$pkgname.environment "$pkgdir"/var/lib/$pkgname/bin/environment install -Dm755 "$srcdir"/$pkgname.env-exec "$pkgdir"/var/lib/$pkgname/bin/env-exec diff --git a/lib/pakman/bootstrap/templates/finish.eex b/lib/pakman/bootstrap/templates/finish.eex new file mode 100644 index 0000000..df63234 --- /dev/null +++ b/lib/pakman/bootstrap/templates/finish.eex @@ -0,0 +1,2 @@ +#!/bin/execlineb -P +s6-permafailon 60 5 1,101-103,SIGSEGV,SIGBUS \ No newline at end of file From c847e285803221f242799c7b6f926347cbd80d78 Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Wed, 29 May 2024 14:57:24 +0700 Subject: [PATCH 2/3] Use develop build --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 4987788..e147e42 100644 --- a/action.yml +++ b/action.yml @@ -47,14 +47,14 @@ runs: uses: actions/cache@v4 with: path: ~/.mix - key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-8.2.8 + key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-develop - name: Install Pakman if: steps.cache-pakman.outputs.cache-hit != 'true' run: | mix local.rebar --force mix local.hex --force - mix escript.install hex pakman 8.2.8 --force + mix escript.install github upmaru/pakman branch develop --force shell: alpine.sh {0} env: MIX_ENV: prod From f1a6f9f561e5d82c9d5415259e10949fbbbc218c Mon Sep 17 00:00:00 2001 From: Zack Siri Date: Wed, 29 May 2024 15:31:29 +0700 Subject: [PATCH 3/3] Bump to 8.2.9 --- action.yml | 4 ++-- mix.exs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index e147e42..4e8f0ee 100644 --- a/action.yml +++ b/action.yml @@ -47,14 +47,14 @@ runs: uses: actions/cache@v4 with: path: ~/.mix - key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-develop + key: ${{ runner.arch }}-alpine-${{ inputs.alpine }}-pakman-8.2.9 - name: Install Pakman if: steps.cache-pakman.outputs.cache-hit != 'true' run: | mix local.rebar --force mix local.hex --force - mix escript.install github upmaru/pakman branch develop --force + mix escript.install hex pakman 8.2.9 --force shell: alpine.sh {0} env: MIX_ENV: prod diff --git a/mix.exs b/mix.exs index e0ac5a4..843f2b3 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pakman.MixProject do def project do [ app: :pakman, - version: "8.2.8", + version: "8.2.9", elixir: "~> 1.13", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,