Set up Rime Ice from the ISO's assets on China installs
This commit is contained in:
1 parent
b6bf851af4
commit
32ebf6b85b
6 files changed
+58
-2
No files matched your search
@@ -55,15 +55,33 @@ fi
|
||||
[[ $output == "Unknown region in $region_file: mars" ]] || fail "an unknown region names the file and value" "$output"
|
||||
pass "an unknown region fails and names the file and value"
|
||||
|
||||
stub_bin="$test_tmp/bin"
|
||||
calls="$test_tmp/calls"
|
||||
mkdir -p "$stub_bin"
|
||||
for command in omarchy-pkg-add rime-ice-installer; do
|
||||
printf '#!/bin/bash\necho "%s $*" >>"%s"\n' "$command" "$calls" >"$stub_bin/$command"
|
||||
done
|
||||
printf '#!/bin/bash\necho "$STUB_REGION"\n' >"$stub_bin/omarchy-region"
|
||||
chmod +x "$stub_bin"/*
|
||||
PATH="$stub_bin:$PATH"
|
||||
|
||||
region_setup="$test_tmp/region.sh"
|
||||
sed "s|/etc/omarchy|$test_tmp/etc-omarchy|g" "$ROOT/install/config/region.sh" >"$region_setup"
|
||||
|
||||
: >"$calls"
|
||||
OMARCHY_REGION=china bash -e "$region_setup"
|
||||
[[ $(<"$test_tmp/etc-omarchy/region") == "china" ]] || fail "install records the China region"
|
||||
pass "install records the China region"
|
||||
[[ $(<"$calls") == "omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer" ]] ||
|
||||
fail "China installs the Rime input method packages" "$(<"$calls")"
|
||||
for package in fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer; do
|
||||
grep -qx "$package" "$ROOT/install/omarchy-other.packages" || fail "the ISO mirror carries $package"
|
||||
done
|
||||
pass "install records the China region and installs the Rime packages the ISO carries"
|
||||
|
||||
: >"$calls"
|
||||
OMARCHY_REGION=global bash -e "$region_setup"
|
||||
[[ ! -e $test_tmp/etc-omarchy/region ]] || fail "install records Global by leaving no region file"
|
||||
[[ ! -s $calls ]] || fail "Global installs no input method packages" "$(<"$calls")"
|
||||
OMARCHY_REGION=china bash -e "$region_setup"
|
||||
env -u OMARCHY_REGION bash -e "$region_setup"
|
||||
[[ ! -e $test_tmp/etc-omarchy/region ]] || fail "an installer that passes no region installs Global"
|
||||
@@ -74,3 +92,22 @@ if output=$(OMARCHY_REGION=mars bash -e "$region_setup" 2>&1); then
|
||||
fi
|
||||
[[ $output == "Unknown OMARCHY_REGION: mars" ]] || fail "install names the unknown region" "$output"
|
||||
pass "install rejects an unknown region"
|
||||
|
||||
user_region="$ROOT/install/user/region.sh"
|
||||
|
||||
: >"$calls"
|
||||
STUB_REGION=China OMARCHY_SETUP_CONTEXT=iso-chroot bash -e "$user_region"
|
||||
[[ $(<"$calls") == "rime-ice-installer --yes --asset-dir /opt/packages/rime-ice" ]] ||
|
||||
fail "a China install sets up Rime Ice from the ISO's assets" "$(<"$calls")"
|
||||
pass "a China install sets up Rime Ice from the ISO's assets"
|
||||
|
||||
: >"$calls"
|
||||
output=$(STUB_REGION=China OMARCHY_SETUP_CONTEXT=provision-owner bash -e "$user_region")
|
||||
[[ ! -s $calls && $output == "Skipping Rime Ice setup in provision-owner: only the ISO bundles its assets" ]] ||
|
||||
fail "first-boot setup says why it skips Rime Ice" "$output $(<"$calls")"
|
||||
pass "first-boot setup says why it skips Rime Ice"
|
||||
|
||||
: >"$calls"
|
||||
output=$(STUB_REGION=Global OMARCHY_SETUP_CONTEXT=iso-chroot bash -e "$user_region")
|
||||
[[ ! -s $calls && -z $output ]] || fail "a Global install leaves the input method alone" "$output $(<"$calls")"
|
||||
pass "a Global install leaves the input method alone"
|
||||
Reference in new issue
Block a user