-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overlay stage1-hooks: Add hooks for libxcrypt migration
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...er/src/third_party/coreos-overlay/coreos/stage1_hooks/0000-glibc-coreos-portage-stable.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |
51 changes: 51 additions & 0 deletions
51
...ner/src/third_party/coreos-overlay/coreos/stage1_hooks/0002-glibc-crypt-coreos-overlay.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
set -x | ||
set -euo pipefail | ||
|
||
stage1_repo="${1}" | ||
new_repo="${2}" | ||
|
||
base_profile_dir='profiles/coreos/base' | ||
|
||
declare -A fixups_old=( | ||
['package.mask']='>=virtual/libcrypt-2' | ||
['package.unmask']='=virtual/libcrypt-1-r1' | ||
['package.use.force']='sys-libs/glibc crypt' | ||
['package.use.mask']='sys-libs/glibc -crypt' | ||
) | ||
|
||
declare -A fixups_new=( | ||
['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 var_name in fixups_old fixups_new; do | ||
declare -n fixups="${var_name}" | ||
|
||
skip='' | ||
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 | ||
skip=x | ||
break | ||
fi | ||
done | ||
|
||
if [[ -n ${skip} ]]; then | ||
unset -n fixups | ||
continue | ||
fi | ||
|
||
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 | ||
exit 0 | ||
done |