diff --git a/builder/prepare-region.sh b/builder/prepare-region.sh index 2707fba..9fec359 100644 --- a/builder/prepare-region.sh +++ b/builder/prepare-region.sh @@ -17,7 +17,8 @@ esac profile="$runtime/default/regions/$region" if [[ ! -f $runtime/bin/omarchy-apply-pacman || ! -f $profile/packages || - ! -f $profile/pacman/pacman.conf.append || ! -f $profile/pacman/mirrorlist.append ]]; then + ! -f $profile/pacman/pacman.conf.append || ! -f $profile/pacman/mirrorlist.append || + ! -d $profile/skel ]]; then echo "Runtime does not support region '$region'; publish a matching runtime or use --local-source." >&2 exit 1 fi diff --git a/test/unit/test_region.py b/test/unit/test_region.py index 5fb514e..3961b56 100644 --- a/test/unit/test_region.py +++ b/test/unit/test_region.py @@ -93,6 +93,7 @@ class RegionBuildTest(unittest.TestCase): self.profile = self.runtime / "default/regions/cn" (self.profile / "pacman").mkdir(parents=True) (self.runtime / "bin").mkdir() + (self.profile / "skel").mkdir() (self.runtime / "bin/omarchy-apply-pacman").touch() (self.profile / "packages").write_text("archlinuxcn-keyring\nfcitx5-rime\n") (self.profile / "pacman/pacman.conf.append").write_text("[archlinuxcn]\nServer = https://mirrors.ustc.edu.cn/archlinuxcn/$arch\n") @@ -148,6 +149,13 @@ class RegionBuildTest(unittest.TestCase): self.assertFalse(self.log.exists()) self.assertEqual(self.config.read_bytes(), self.original_config) + def test_profile_without_user_defaults_fails_before_package_operations(self): + (self.profile / "skel").rmdir() + result = self.prepare("cn") + self.assertNotEqual(result.returncode, 0) + self.assertFalse(self.log.exists()) + self.assertEqual(self.packages.read_text(), "base\n") + def test_untrusted_keyring_aborts_without_importing_keys(self): result = self.prepare("cn", TEST_PACMAN_STATUS="1") self.assertNotEqual(result.returncode, 0)