Skip to content

Commit

Permalink
overlay stage1-hooks: Add hooks for libxcrypt migration
Browse files Browse the repository at this point in the history
  • Loading branch information
krnowak committed Mar 6, 2024
1 parent 362850c commit 4c76b3f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -x
set -euo pipefail

stage1_repo="${1}"
new_repo="${2}"

cat=sys-libs
pkg=libxcrypt

if [[ -d "${stage1_repo}/${cat}/${pkg}" ]]; then
# libxcrypt is already a part of portage-stable, nothing to do
exit 0
fi

mkdir -p "${stage1_repo}/${cat}"
cp -a "${new_repo}/${cat}/${pkg}" "${stage1_repo}/${cat}/${pkg}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -x
set -euo pipefail

stage1_repo="${1}"
new_repo="${2}"

base_profile_dir='profiles/coreos/base'

declare -A fixups=(
['package.mask']='>=virtual/libcrypt-2'
['package.unmask']='<virtual/libcrypt-2'
['package.use.force']='sys-libs/glibc crypt'
['package.use.mask']='sys-libs/glibc -crypt'
)

for f in "${!fixups[@]}"; do
l=${fixups["${f}"]}
ff="${stage1_repo}/${base_profile_dir}/${f}"
if ! grep --quiet --fixed-strings --line-regexp --regexp="${l}" -- "${ff}"; then
# fixup not applicable, nothing to do
exit 0
fi
done

for f in "${!fixups[@]}"; do
l=${fixups["${f}"]}
ff="${stage1_repo}/${base_profile_dir}/${f}"
ffb="${ff}.bak"
mv "${ff}" "${ffb}"
grep --invert-match --fixed-strings --line-regexp --regexp="${l}" -- "${ffb}" >"${ff}"
done

0 comments on commit 4c76b3f

Please sign in to comment.