Compare commits
445 commits
7bb0f9b6a3
...
8f47cde54d
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 8f47cde54d | ||
Manuel Thalmann | b82faa463c | ||
Manuel Thalmann | 70105a4c26 | ||
Manuel Thalmann | a85365ef6a | ||
Manuel Thalmann | 0efe059126 | ||
Manuel Thalmann | f8a956f761 | ||
Manuel Thalmann | 4582e288d7 | ||
Manuel Thalmann | 0317202c01 | ||
Manuel Thalmann | 164cfaef16 | ||
Manuel Thalmann | 47490f9c9e | ||
Manuel Thalmann | cead93fabb | ||
Manuel Thalmann | 5dfc580066 | ||
Manuel Thalmann | 6cb55d1ef5 | ||
Manuel Thalmann | 3ced64b83a | ||
Manuel Thalmann | 90cff7df22 | ||
Manuel Thalmann | aeca588808 | ||
Manuel Thalmann | ab4906cd3a | ||
Manuel Thalmann | e1399b527c | ||
Manuel Thalmann | 691162c51d | ||
Manuel Thalmann | 6f67f90074 | ||
Manuel Thalmann | 8a06f62b85 | ||
Manuel Thalmann | 9ecac43db8 | ||
Manuel Thalmann | 64572662eb | ||
Manuel Thalmann | 7096243208 | ||
Manuel Thalmann | 076e3e35fa | ||
Manuel Thalmann | 5e57090030 | ||
Manuel Thalmann | 139924b0e3 | ||
Manuel Thalmann | d23081f52e | ||
Manuel Thalmann | 9beeaf2924 | ||
Manuel Thalmann | 6890d5104f | ||
Manuel Thalmann | f1b9a541e6 | ||
Manuel Thalmann | 54bfcba2e3 | ||
Manuel Thalmann | ab1ebe29cf | ||
Manuel Thalmann | 26cb03ca26 | ||
Manuel Thalmann | 5e4322dacf | ||
Manuel Thalmann | 5437886a77 | ||
Manuel Thalmann | c1bf82b084 | ||
Manuel Thalmann | ce785af138 | ||
Manuel Thalmann | 0576a87f01 | ||
Manuel Thalmann | af4a33ac3f | ||
Manuel Thalmann | 9e9a0f9fab | ||
Manuel Thalmann | 5fb11eb5c7 | ||
Manuel Thalmann | 5e5759d75b | ||
Manuel Thalmann | 53e941216c | ||
Manuel Thalmann | bad17b213c | ||
Manuel Thalmann | e7c483db2b | ||
Manuel Thalmann | 9b0bf565f6 | ||
Manuel Thalmann | aa278cd675 | ||
Manuel Thalmann | 2a69eabe81 | ||
Manuel Thalmann | 65ba609a3b | ||
Manuel Thalmann | d29f925a8b | ||
Manuel Thalmann | 8332affb78 | ||
Manuel Thalmann | d6b330e07c | ||
Manuel Thalmann | 0b3c738444 | ||
Manuel Thalmann | d4fd4903ba | ||
Manuel Thalmann | 9383be6124 | ||
Manuel Thalmann | d42719c52a | ||
Manuel Thalmann | 6e9a82d59e | ||
Manuel Thalmann | 68b4810051 | ||
Manuel Thalmann | a3d2d9c002 | ||
Manuel Thalmann | 6bc6b85598 | ||
Manuel Thalmann | 5ea09f9477 | ||
Manuel Thalmann | 7952bcf207 | ||
Manuel Thalmann | bb5c47792e | ||
Manuel Thalmann | 03349f772f | ||
Manuel Thalmann | 20fe9287d0 | ||
Manuel Thalmann | 469690edc5 | ||
Manuel Thalmann | de247e65fa | ||
Manuel Thalmann | 9a9d4f6068 | ||
Manuel Thalmann | 1a03d23d11 | ||
Manuel Thalmann | e6b4c5153e | ||
Manuel Thalmann | 38cf1fcc48 | ||
Manuel Thalmann | 462e0bb650 | ||
Manuel Thalmann | 3cf55b510c | ||
Manuel Thalmann | 0ec0264c8e | ||
Manuel Thalmann | 9ff31b0bdc | ||
Manuel Thalmann | 97366cd1f6 | ||
Manuel Thalmann | 62a67954f6 | ||
Manuel Thalmann | 6452c3381f | ||
Manuel Thalmann | 7f32b855e9 | ||
Manuel Thalmann | 148becb52d | ||
Manuel Thalmann | 98d06dfc07 | ||
Manuel Thalmann | b54ddf43c7 | ||
Manuel Thalmann | 320a4b9b36 | ||
Manuel Thalmann | 0d41e9a278 | ||
Manuel Thalmann | 595076817a | ||
Manuel Thalmann | ca08608601 | ||
Manuel Thalmann | 36b06c7fa4 | ||
Manuel Thalmann | 7fc948b1b8 | ||
Manuel Thalmann | 16eaaa1929 | ||
Manuel Thalmann | 6fa0653e01 | ||
Manuel Thalmann | 9ac3b46819 | ||
Manuel Thalmann | 40ae6fc13c | ||
Manuel Thalmann | d80eba1ec6 | ||
Manuel Thalmann | d3a632c1d1 | ||
Manuel Thalmann | 4a7406d239 | ||
Manuel Thalmann | 57fd3e32ed | ||
Manuel Thalmann | 66d2cd88f9 | ||
Manuel Thalmann | bffd07052b | ||
Manuel Thalmann | 5cd815aaf9 | ||
Manuel Thalmann | 7f54e2d7c8 | ||
Manuel Thalmann | db5c553657 | ||
Manuel Thalmann | a26e106ccb | ||
Manuel Thalmann | 7095b9a35d | ||
Manuel Thalmann | dd849f9ba1 | ||
Manuel Thalmann | 16e2b5450b | ||
Manuel Thalmann | eb1124b038 | ||
Manuel Thalmann | d90f0c3969 | ||
Manuel Thalmann | 3ac390f708 | ||
Manuel Thalmann | 60abe32e27 | ||
Manuel Thalmann | 6abf26ea45 | ||
Manuel Thalmann | 2460cb7878 | ||
Manuel Thalmann | 05fb824015 | ||
Manuel Thalmann | d214abd1e8 | ||
Manuel Thalmann | 1afb28c31a | ||
Manuel Thalmann | 05de760fe5 | ||
Manuel Thalmann | b1fdf57b7f | ||
Manuel Thalmann | ae349afc8a | ||
Manuel Thalmann | 868a56a558 | ||
Manuel Thalmann | 6616720f1a | ||
Manuel Thalmann | 33684088e3 | ||
Manuel Thalmann | 8f26ea1fb2 | ||
Manuel Thalmann | e6a9a280eb | ||
Manuel Thalmann | 619ae6ee59 | ||
Manuel Thalmann | 92f9ff817a | ||
Manuel Thalmann | 7b18f9e920 | ||
Manuel Thalmann | 55b1cba4e6 | ||
Manuel Thalmann | 1ce158b1a4 | ||
Manuel Thalmann | 671d7c1b7d | ||
Manuel Thalmann | 6c9fbb4ca7 | ||
Manuel Thalmann | efdc1b4aa7 | ||
Manuel Thalmann | d6db12504d | ||
Manuel Thalmann | 1ae778e714 | ||
Manuel Thalmann | ab52b3ddaf | ||
Manuel Thalmann | 97907f2ce5 | ||
Manuel Thalmann | 759bba51eb | ||
Manuel Thalmann | fcad25bffb | ||
Manuel Thalmann | 399445aa81 | ||
Manuel Thalmann | b2d49f4722 | ||
Manuel Thalmann | f8fbd78725 | ||
Manuel Thalmann | 1619179f59 | ||
Manuel Thalmann | ffd4581372 | ||
Manuel Thalmann | f31db199ff | ||
Manuel Thalmann | 83a0eede62 | ||
Manuel Thalmann | c1a8ba2f8f | ||
Manuel Thalmann | 4a24e241d8 | ||
Manuel Thalmann | ca1ae57aa7 | ||
Manuel Thalmann | 257f934985 | ||
Manuel Thalmann | 3d2810eb67 | ||
Manuel Thalmann | 3f8fb6a7e5 | ||
Manuel Thalmann | 7afbc1f7c1 | ||
Manuel Thalmann | ad48c77df8 | ||
Manuel Thalmann | 0e6b1206c3 | ||
Manuel Thalmann | c7d3501a36 | ||
Manuel Thalmann | 038a4b8776 | ||
Manuel Thalmann | 36f78e0358 | ||
Manuel Thalmann | 6414d449eb | ||
Manuel Thalmann | dce5769762 | ||
Manuel Thalmann | c859646800 | ||
Manuel Thalmann | 65ada0273e | ||
Manuel Thalmann | 42ca57c698 | ||
Manuel Thalmann | 611c3e872e | ||
Manuel Thalmann | ac09e5ab1b | ||
Manuel Thalmann | 1508e18afa | ||
Manuel Thalmann | 259a3a0b97 | ||
Manuel Thalmann | 2af9f2c707 | ||
Manuel Thalmann | 371bff0c9e | ||
Manuel Thalmann | bcf3e5973d | ||
Manuel Thalmann | b3f005c0ed | ||
Manuel Thalmann | c3e7a9ac9e | ||
Manuel Thalmann | 0a7a79f1aa | ||
Manuel Thalmann | 343df612ef | ||
Manuel Thalmann | 78db8f7fd8 | ||
Manuel Thalmann | f296b609aa | ||
Manuel Thalmann | 596073974b | ||
Manuel Thalmann | 5cdd8c10a0 | ||
Manuel Thalmann | a6ac5c1653 | ||
Manuel Thalmann | e0a2aeac06 | ||
Manuel Thalmann | 37f7513c31 | ||
Manuel Thalmann | 63a8ef522a | ||
Manuel Thalmann | 1c5b252e28 | ||
Manuel Thalmann | 2c8813b965 | ||
Manuel Thalmann | d7aec2d3dd | ||
Manuel Thalmann | c1b6d96d19 | ||
Manuel Thalmann | 1bad412e7e | ||
Manuel Thalmann | 01981835ba | ||
Manuel Thalmann | 75aad9d526 | ||
Manuel Thalmann | 200c3cfb80 | ||
Manuel Thalmann | 00519e29db | ||
Manuel Thalmann | 771f7e2c00 | ||
Manuel Thalmann | 49a4e7332d | ||
Manuel Thalmann | 03de3b3bdf | ||
Manuel Thalmann | 513cedee3f | ||
Manuel Thalmann | e060eda21e | ||
Manuel Thalmann | 44f54a280d | ||
Manuel Thalmann | a55462b9ab | ||
Manuel Thalmann | 7bede45d69 | ||
Manuel Thalmann | 725a738ac4 | ||
Manuel Thalmann | 523eb674a9 | ||
Manuel Thalmann | 70488039e7 | ||
Manuel Thalmann | 1ad66323cc | ||
Manuel Thalmann | d894e7141f | ||
Manuel Thalmann | e78a2f7949 | ||
Manuel Thalmann | 97d956e534 | ||
Manuel Thalmann | 46d22638db | ||
Manuel Thalmann | 0f8afcc4cc | ||
Manuel Thalmann | b1445d8783 | ||
Manuel Thalmann | 0db26587ff | ||
Manuel Thalmann | cf88324e0e | ||
Manuel Thalmann | 463f2ad4f4 | ||
Manuel Thalmann | 5c302fe4be | ||
Manuel Thalmann | efd9d0b524 | ||
Manuel Thalmann | dd00760aa7 | ||
Manuel Thalmann | fe70445d02 | ||
Manuel Thalmann | 10d584c7d9 | ||
Manuel Thalmann | d63b0904e6 | ||
Manuel Thalmann | 3a660c6f0e | ||
Manuel Thalmann | 2d5ba4972f | ||
Manuel Thalmann | fdee733a3c | ||
Manuel Thalmann | 8c829fcd05 | ||
Manuel Thalmann | 546c878c26 | ||
Manuel Thalmann | 09ecd570f3 | ||
Manuel Thalmann | 326ec92b55 | ||
Manuel Thalmann | 6731e39b6a | ||
Manuel Thalmann | cce56d9d6f | ||
Manuel Thalmann | 4e3089264e | ||
Manuel Thalmann | 2b54e79624 | ||
Manuel Thalmann | cdc9c2edfa | ||
Manuel Thalmann | 6de884bed4 | ||
Manuel Thalmann | 4d930a09ba | ||
Manuel Thalmann | 62b13553ac | ||
Manuel Thalmann | db37209a14 | ||
Manuel Thalmann | 767b7ad228 | ||
Manuel Thalmann | f4c89ab20a | ||
Manuel Thalmann | 617fdef38e | ||
Manuel Thalmann | 8297bcc4cb | ||
Manuel Thalmann | f772108ffa | ||
Manuel Thalmann | fba3e5d860 | ||
Manuel Thalmann | 36796cede6 | ||
Manuel Thalmann | eb43134682 | ||
Manuel Thalmann | be74a65f0c | ||
Manuel Thalmann | 66e270f34d | ||
Manuel Thalmann | f79112eaea | ||
Manuel Thalmann | e6b78fbfeb | ||
Manuel Thalmann | 6b678efb7c | ||
Manuel Thalmann | 835644f770 | ||
Manuel Thalmann | c8c7d5a496 | ||
Manuel Thalmann | fa4327275c | ||
Manuel Thalmann | 7cf7bcd027 | ||
Manuel Thalmann | e5eff422ff | ||
Manuel Thalmann | 1b58282f69 | ||
Manuel Thalmann | fb35f198b4 | ||
Manuel Thalmann | bc46a64b9a | ||
Manuel Thalmann | 998d6c181b | ||
Manuel Thalmann | cdf5cbe419 | ||
Manuel Thalmann | 9ae994d5db | ||
Manuel Thalmann | ad09c4dcbf | ||
Manuel Thalmann | f22f2994d3 | ||
Manuel Thalmann | f7bee2a4db | ||
Manuel Thalmann | fb1d55bda3 | ||
Manuel Thalmann | 2f6530a9fb | ||
Manuel Thalmann | 5310089e42 | ||
Manuel Thalmann | 43226734cf | ||
Manuel Thalmann | 962ff80697 | ||
Manuel Thalmann | 30c13e6cc4 | ||
Manuel Thalmann | 5da67032a3 | ||
Manuel Thalmann | 0246aec7a0 | ||
Manuel Thalmann | a91bb53a07 | ||
Manuel Thalmann | 12751ced57 | ||
Manuel Thalmann | e1884b2a7d | ||
Manuel Thalmann | 1e2f61c8bb | ||
Manuel Thalmann | 8a59fd4c5d | ||
Manuel Thalmann | daa37a1b9b | ||
Manuel Thalmann | 47b014e3cd | ||
Manuel Thalmann | 617c6ce8ef | ||
Manuel Thalmann | 329007b063 | ||
Manuel Thalmann | 67ccb819e0 | ||
Manuel Thalmann | f278409727 | ||
Manuel Thalmann | a8b35f4406 | ||
Manuel Thalmann | 828c27352d | ||
Manuel Thalmann | af8541791b | ||
Manuel Thalmann | 1dbfe0ab4d | ||
Manuel Thalmann | 594a425cd3 | ||
Manuel Thalmann | a9b8ecf105 | ||
Manuel Thalmann | d345488655 | ||
Manuel Thalmann | e4bf4898ec | ||
Manuel Thalmann | de3aaedad0 | ||
Manuel Thalmann | 4fd18e32b6 | ||
Manuel Thalmann | 98248d23e0 | ||
Manuel Thalmann | ae555e133d | ||
Manuel Thalmann | 6a8303fdc2 | ||
Manuel Thalmann | f2cd00248a | ||
Manuel Thalmann | 7118ec594f | ||
Manuel Thalmann | 580f06779f | ||
Manuel Thalmann | 43bc0fae7e | ||
Manuel Thalmann | f5533bf7f6 | ||
Manuel Thalmann | 2aa608bc8d | ||
Manuel Thalmann | d1a1a13346 | ||
Manuel Thalmann | 95418ba6aa | ||
Manuel Thalmann | 6c06f719c9 | ||
Manuel Thalmann | bf9679e522 | ||
Manuel Thalmann | 0af53191ba | ||
Manuel Thalmann | e735320fcb | ||
Manuel Thalmann | 76ba329ad2 | ||
Manuel Thalmann | 69925fac74 | ||
Manuel Thalmann | 8ad9f00956 | ||
Manuel Thalmann | 2ac7045883 | ||
Manuel Thalmann | 4613f82442 | ||
Manuel Thalmann | 95922559c2 | ||
Manuel Thalmann | 2eebf4db53 | ||
Manuel Thalmann | 2ee11b7fa3 | ||
Manuel Thalmann | 2612b6b6de | ||
Manuel Thalmann | 584841870b | ||
Manuel Thalmann | e204d0f819 | ||
Manuel Thalmann | a8a99ffc23 | ||
Manuel Thalmann | 88dfbc30c9 | ||
Manuel Thalmann | eeee33917a | ||
Manuel Thalmann | 6ce28f4751 | ||
Manuel Thalmann | db99c0a10b | ||
Manuel Thalmann | 4f3573329a | ||
Manuel Thalmann | 7b31ecf85e | ||
Manuel Thalmann | 1d0270e455 | ||
Manuel Thalmann | 32daa81086 | ||
Manuel Thalmann | a86b1b1069 | ||
Manuel Thalmann | 52caf4d991 | ||
Manuel Thalmann | 211700fbee | ||
Manuel Thalmann | 38deb9dc88 | ||
Manuel Thalmann | cfc5643347 | ||
Manuel Thalmann | 60b9464dfb | ||
Manuel Thalmann | 09009b3541 | ||
Manuel Thalmann | 9d024f9c3e | ||
Manuel Thalmann | 7b9eb1b370 | ||
Manuel Thalmann | 99cc9cb12b | ||
Manuel Thalmann | b024445989 | ||
Manuel Thalmann | 498d65e24a | ||
Manuel Thalmann | 0e30d9cc0b | ||
Manuel Thalmann | 2e042f9e1b | ||
Manuel Thalmann | 339379a04f | ||
Manuel Thalmann | 5145b5383f | ||
Manuel Thalmann | e9b0cb3f7f | ||
Manuel Thalmann | 1d6fafa73f | ||
Manuel Thalmann | 37e5636da1 | ||
Manuel Thalmann | 9ab7cdc4d0 | ||
Manuel Thalmann | 27d2797ed2 | ||
Manuel Thalmann | 164a3b60ef | ||
Manuel Thalmann | d13d774b4b | ||
Manuel Thalmann | 7b8849e0bf | ||
Manuel Thalmann | 629e2044c7 | ||
Manuel Thalmann | 9602b40c50 | ||
Manuel Thalmann | ebc90e6e2e | ||
Manuel Thalmann | 603d665f9e | ||
Manuel Thalmann | 5b299e432d | ||
Manuel Thalmann | 32a190342f | ||
Manuel Thalmann | 51558e02c9 | ||
Manuel Thalmann | 87036479fa | ||
Manuel Thalmann | 118b653a63 | ||
Manuel Thalmann | 0fc2d9348c | ||
Manuel Thalmann | c95519fef7 | ||
Manuel Thalmann | c437c6c6cf | ||
Manuel Thalmann | 0c47df9f00 | ||
Manuel Thalmann | e230a95209 | ||
Manuel Thalmann | dbe0515965 | ||
Manuel Thalmann | 13b33d6ee8 | ||
Manuel Thalmann | 2bde374dca | ||
Manuel Thalmann | a919979a68 | ||
Manuel Thalmann | 83bf9a4d32 | ||
Manuel Thalmann | fa57e95def | ||
Manuel Thalmann | 1e6d44d1bb | ||
Manuel Thalmann | 2fe3b639f7 | ||
Manuel Thalmann | 92dee406ff | ||
Manuel Thalmann | c37ea23130 | ||
Manuel Thalmann | a9769bd980 | ||
Manuel Thalmann | 290b9a3611 | ||
Manuel Thalmann | 633df57fee | ||
Manuel Thalmann | f43e612883 | ||
Manuel Thalmann | 00ee61ac90 | ||
Manuel Thalmann | 39803bbbba | ||
Manuel Thalmann | db38915911 | ||
Manuel Thalmann | fb02b79a4d | ||
Manuel Thalmann | 8c447dabbe | ||
Manuel Thalmann | 7a47b016ef | ||
Manuel Thalmann | a9ae8c9a98 | ||
Manuel Thalmann | 72fd72f5bd | ||
Manuel Thalmann | 4906bb0b24 | ||
Manuel Thalmann | 2e03728d44 | ||
Manuel Thalmann | b5d9489f21 | ||
Manuel Thalmann | d9be9fe3da | ||
Manuel Thalmann | 8dbac3564d | ||
Manuel Thalmann | 38f65b3e63 | ||
Manuel Thalmann | 06b314b1f5 | ||
Manuel Thalmann | 9bcdd2fd9f | ||
Manuel Thalmann | 429cc25c4c | ||
Manuel Thalmann | 629046b212 | ||
Manuel Thalmann | 369fcaed00 | ||
Manuel Thalmann | cc77eaf05c | ||
Manuel Thalmann | 9324e3074f | ||
Manuel Thalmann | c5be70b11d | ||
Manuel Thalmann | 38ed315bd2 | ||
Manuel Thalmann | d3dd4ff5a9 | ||
Manuel Thalmann | 5b0074bea9 | ||
Manuel Thalmann | 6612b9e7d4 | ||
Manuel Thalmann | 1fb70ecda0 | ||
Manuel Thalmann | 781d133e7e | ||
Manuel Thalmann | bba8da3b84 | ||
Manuel Thalmann | 86732247b9 | ||
Manuel Thalmann | be41a143c0 | ||
Manuel Thalmann | 8f0e147fa0 | ||
Manuel Thalmann | fa60493ae1 | ||
Manuel Thalmann | a6985d7e1b | ||
Manuel Thalmann | 5bb0cd41cc | ||
Manuel Thalmann | 467b429bd9 | ||
Manuel Thalmann | f228817817 | ||
Manuel Thalmann | e327ca8d17 | ||
Manuel Thalmann | 734ae7bd05 | ||
Manuel Thalmann | cd3f85103a | ||
Manuel Thalmann | dbdedad1d9 | ||
Manuel Thalmann | 31c30e6854 | ||
Manuel Thalmann | 89183dbeed | ||
Manuel Thalmann | 64c2ba9127 | ||
Manuel Thalmann | d07d4c9057 | ||
Manuel Thalmann | bb0b4a5988 | ||
Manuel Thalmann | 1be172ae07 | ||
Manuel Thalmann | fad332b267 | ||
Manuel Thalmann | c137952345 | ||
Manuel Thalmann | 156c72c977 | ||
Manuel Thalmann | 8d9e9ca3a6 | ||
Manuel Thalmann | ca2a5f23b0 | ||
Manuel Thalmann | 4e87165196 | ||
Manuel Thalmann | 0d926a06b8 | ||
Manuel Thalmann | ea991759af | ||
Manuel Thalmann | d285e69c97 | ||
Manuel Thalmann | 974b1b8083 | ||
Manuel Thalmann | 6e505faada | ||
Manuel Thalmann | 8e1f3e0148 | ||
Manuel Thalmann | 346614deee | ||
Manuel Thalmann | 4d2c02c2b5 | ||
Manuel Thalmann | 852b1c71ce | ||
Manuel Thalmann | e87a39691b | ||
Manuel Thalmann | 06cbabc36c | ||
Manuel Thalmann | 5b650f7efc | ||
Manuel Thalmann | 5f0a25deb2 | ||
Manuel Thalmann | 3c6933c03d | ||
Manuel Thalmann | f3049e9fd2 | ||
Manuel Thalmann | 4a34593d83 | ||
Manuel Thalmann | 7d322b8759 |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.fish text eol=lf
|
||||||
|
*.sh text eol=lf
|
|
@ -23,7 +23,7 @@ automated_script() {
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
printf '%s: downloading %s\n' "$0" "${script}"
|
printf '%s: downloading %s\n' "$0" "${script}"
|
||||||
curl "${script}" --location --retry-connrefused --retry 10 -s -o /tmp/startup_script
|
curl "${script}" --location --retry-connrefused --retry 10 --fail -s -o /tmp/startup_script
|
||||||
rt=$?
|
rt=$?
|
||||||
else
|
else
|
||||||
cp "${script}" /tmp/startup_script
|
cp "${script}" /tmp/startup_script
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
|
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
|
||||||
index bf6bc8f..76e5893 100755
|
index bf6bc8f..a0dae7b 100755
|
||||||
--- a/airootfs/root/.zlogin
|
--- a/airootfs/root/.zlogin
|
||||||
+++ b/airootfs/root/.zlogin
|
+++ b/airootfs/root/.zlogin
|
||||||
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
@@ -4,3 +4,19 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
~/.automated_script.sh
|
~/.automated_script.sh
|
||||||
|
@ -16,13 +16,14 @@ index bf6bc8f..76e5893 100755
|
||||||
+
|
+
|
||||||
+git diff -p -R --no-ext-diff --no-color --diff-filter=M \
|
+git diff -p -R --no-ext-diff --no-color --diff-filter=M \
|
||||||
+ | grep -E "^(diff|(old|new) mode)" --color=never \
|
+ | grep -E "^(diff|(old|new) mode)" --color=never \
|
||||||
|
+ | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \
|
||||||
+ | git apply
|
+ | git apply
|
||||||
+
|
+
|
||||||
+popd > /dev/null
|
+popd > /dev/null
|
||||||
+
|
+
|
||||||
+loadkeys de_CH-latin1
|
+loadkeys de_CH-latin1
|
||||||
diff --git a/packages.x86_64 b/packages.x86_64
|
diff --git a/packages.x86_64 b/packages.x86_64
|
||||||
index 9e876e7..b89ab30 100755
|
index 9e876e7..c5db92a 100755
|
||||||
--- a/packages.x86_64
|
--- a/packages.x86_64
|
||||||
+++ b/packages.x86_64
|
+++ b/packages.x86_64
|
||||||
@@ -30,8 +30,10 @@ ethtool
|
@@ -30,8 +30,10 @@ ethtool
|
||||||
|
@ -36,7 +37,15 @@ index 9e876e7..b89ab30 100755
|
||||||
gnu-netcat
|
gnu-netcat
|
||||||
gpart
|
gpart
|
||||||
gpm
|
gpm
|
||||||
@@ -75,6 +77,7 @@ nbd
|
@@ -45,6 +47,7 @@ irssi
|
||||||
|
iw
|
||||||
|
iwd
|
||||||
|
jfsutils
|
||||||
|
+jq
|
||||||
|
kitty-terminfo
|
||||||
|
ldns
|
||||||
|
less
|
||||||
|
@@ -75,6 +78,7 @@ nbd
|
||||||
ndisc6
|
ndisc6
|
||||||
nfs-utils
|
nfs-utils
|
||||||
nilfs-utils
|
nilfs-utils
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
|
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, flake-utils, nixpkgs }: flake-utils.lib.eachDefaultSystem (
|
outputs = { self, flake-utils, nixpkgs }: (flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
|
@ -32,5 +32,10 @@
|
||||||
packages = {
|
packages = {
|
||||||
archiso = pkgs.archiso;
|
archiso = pkgs.archiso;
|
||||||
};
|
};
|
||||||
});
|
})) // {
|
||||||
|
valhalla = {
|
||||||
|
DerGeret = import ./profiles/machines/manuel/DerGeret/Arch/config.nix;
|
||||||
|
ManuSurface = import ./profiles/machines/manuel/ManuSurface/Arch/config.nix;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
15
lib/eval-attribute.nix
Normal file
15
lib/eval-attribute.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
nixpkgs = import <nixpkgs> { config = {}; overlay = []; };
|
||||||
|
property = (builtins.getEnv "PROPERTY");
|
||||||
|
processor = if (builtins.stringLength property > 0)
|
||||||
|
then
|
||||||
|
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
|
||||||
|
else
|
||||||
|
(_: _);
|
||||||
|
in
|
||||||
|
_: processor (lib.evalModules {
|
||||||
|
modules = [
|
||||||
|
_
|
||||||
|
];
|
||||||
|
}).config
|
|
@ -1,7 +0,0 @@
|
||||||
{ lib, ... }: {
|
|
||||||
options = {
|
|
||||||
valhalla = {
|
|
||||||
git = (import ./git/options.nix) { inherit lib; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (lib)
|
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
in {
|
|
||||||
defaultBranch = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of the default branch in git.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
flow = {
|
|
||||||
mainBranch = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of the stable branch in git flow.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
devBranch = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of the development branch in git flow.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
aliases = mkOption {
|
|
||||||
type = types.attrsOf types.str;
|
|
||||||
description = "Git command aliases to install.";
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
}
|
|
55
lib/modules/hardware.nix
Normal file
55
lib/modules/hardware.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla = {
|
||||||
|
hardware = {
|
||||||
|
components = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "The names of the hardware components of the computer.";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
eyeX = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether a Tobii EyeX device is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
amdCPU = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether an AMD CPU is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
nvidiaGPU = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether an NVIDIA GPU is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
corsairDevice = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether a Corsair device is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
elgatoWave = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether an Elgato Wave device is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
logitechG = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether a Logitech G device is present.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
52
lib/modules/os.nix
Normal file
52
lib/modules/os.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla = mkOption {
|
||||||
|
type = types.submodule (
|
||||||
|
{ extendModules, ... }:
|
||||||
|
let
|
||||||
|
osVariant = extendModules {
|
||||||
|
modules = [
|
||||||
|
({ config, ... }: {
|
||||||
|
options = {
|
||||||
|
config = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
description = "The configuration of the Operating System.";
|
||||||
|
default = builtins.removeAttrs config ["_module" "config" "linux" "windows"];
|
||||||
|
visible = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
linuxVariant = osVariant.extendModules { };
|
||||||
|
windowsVariant = osVariant.extendModules { };
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
linux = mkOption {
|
||||||
|
inherit (linuxVariant) type;
|
||||||
|
description = "The options for setting up Linux.";
|
||||||
|
default = {};
|
||||||
|
visible = "shallow";
|
||||||
|
};
|
||||||
|
|
||||||
|
windows = mkOption {
|
||||||
|
inherit (windowsVariant) type;
|
||||||
|
description = "The options for setting up Windows.";
|
||||||
|
default = {};
|
||||||
|
visible = "shallow";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
description = "Configuration for PortValhalla.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
59
lib/modules/packages/git.nix
Normal file
59
lib/modules/packages/git.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
|
gitType = types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
defaultBranch = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The name of the default branch in newly created repositories.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
flow = {
|
||||||
|
mainBranch = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The name of the stable branch in git flow.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
devBranch = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The name of the development branch in git flow.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
aliases = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
description = "The git command aliases to install.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
gitOption = mkOption {
|
||||||
|
type = gitType;
|
||||||
|
description = "The git related options.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla = {
|
||||||
|
git = gitOption;
|
||||||
|
|
||||||
|
users = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
git = gitOption;
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
44
lib/modules/packages/nextcloud.nix
Normal file
44
lib/modules/packages/nextcloud.nix
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
|
syncType = types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
remotePath = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The path to the folder on the cloud to sync.";
|
||||||
|
};
|
||||||
|
|
||||||
|
localPath = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The path to sync the cloud content to.";
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualFiles = (mkEnableOption "virtual file support") // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla.windows.users = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
nextcloud = {
|
||||||
|
folderSyncs = mkOption {
|
||||||
|
type = types.listOf syncType;
|
||||||
|
description = "The folders to synchronize.";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
60
lib/modules/packages/oh-my-posh.nix
Normal file
60
lib/modules/packages/oh-my-posh.nix
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
|
themeType = types.submodule (
|
||||||
|
{ config, ... }: {
|
||||||
|
options = {
|
||||||
|
source = mkOption {
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
description = "The path to the oh-my-posh theme to use.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
name = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The name of the theme.";
|
||||||
|
default = if (config.source != null)
|
||||||
|
then
|
||||||
|
lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source))
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
ompType = types.submodule (
|
||||||
|
{ config, ... }: {
|
||||||
|
options = {
|
||||||
|
theme = mkOption {
|
||||||
|
type = types.either types.str themeType;
|
||||||
|
description = "The default theme.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
additionalThemes = mkOption {
|
||||||
|
type = types.listOf themeType;
|
||||||
|
description = "A set of additional themes to install.";
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla.users = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
oh-my-posh = mkOption {
|
||||||
|
type = ompType;
|
||||||
|
description = "The Oh My Posh configuration to apply.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
40
lib/modules/packages/rclone.nix
Normal file
40
lib/modules/packages/rclone.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
|
syncType = types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
dirName = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The name of the directory to sync the remote files to.";
|
||||||
|
};
|
||||||
|
|
||||||
|
cacheDuration = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The amount of time to keep cached files.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla.linux.users = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
rclone = {
|
||||||
|
configurations = mkOption {
|
||||||
|
type = types.attrsOf syncType;
|
||||||
|
description = "The configurations of the rclone mounts.";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,24 +5,10 @@
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
|
||||||
syncType = types.submodule (
|
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||||
{ ... }: {
|
|
||||||
options = {
|
|
||||||
dirName = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The name of the directory to sync the remote files to.";
|
|
||||||
};
|
|
||||||
|
|
||||||
cacheDuration = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The amount of time to keep cached files.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
userType = types.submodule (
|
userType = types.submodule (
|
||||||
{ ... }: {
|
{ ... } : {
|
||||||
options = {
|
options = {
|
||||||
displayName = mkOption {
|
displayName = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
|
@ -41,21 +27,27 @@
|
||||||
description = "The additional groups of the user.";
|
description = "The additional groups of the user.";
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
linuxUserType = types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
defaultShell = mkOption {
|
defaultShell = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
description = "The default shell of the user.";
|
description = "The default shell of the user.";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
git = (import ./git/options.nix) { inherit lib; };
|
winUserType = types.submodule (
|
||||||
|
{ ... }: {
|
||||||
rclone = {
|
options = {
|
||||||
configurations = mkOption {
|
microsoftAccount = mkOption {
|
||||||
type = types.attrsOf syncType;
|
type = types.bool;
|
||||||
description = "The configurations of the rclone mounts.";
|
description = "A value indicating whether this user is a Microsoft Account.";
|
||||||
default = {};
|
default = false;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -67,6 +59,33 @@
|
||||||
description = "The users to create on the machine.";
|
description = "The users to create on the machine.";
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
linux.users = mkOption {
|
||||||
|
type = types.attrsOf linuxUserType;
|
||||||
|
};
|
||||||
|
|
||||||
|
windows = mkOption {
|
||||||
|
type = types.submoduleWith {
|
||||||
|
modules = [
|
||||||
|
({ config, options, ... }: {
|
||||||
|
options = {
|
||||||
|
users = mkOption {
|
||||||
|
type = types.attrsOf winUserType;
|
||||||
|
};
|
||||||
|
|
||||||
|
winUsers = mkOption {
|
||||||
|
type = options.users.type;
|
||||||
|
description = "Blablabla";
|
||||||
|
default = (lib.attrsets.concatMapAttrs (
|
||||||
|
name: options: {
|
||||||
|
${capitalize name} = options;
|
||||||
|
}) config.users);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,13 @@
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./git.nix
|
./packages/git.nix
|
||||||
|
./packages/nextcloud.nix
|
||||||
|
./packages/oh-my-posh.nix
|
||||||
|
./packages/rclone.nix
|
||||||
|
./hardware.nix
|
||||||
./i18n.nix
|
./i18n.nix
|
||||||
|
./os.nix
|
||||||
./partition.nix
|
./partition.nix
|
||||||
./software.nix
|
./software.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
{ lib, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkDefault
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkIf
|
mkIf
|
||||||
|
mkOption
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
|
||||||
winType = types.submodule (
|
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||||
{ config, ... }: {
|
in {
|
||||||
options = {
|
options = {
|
||||||
|
valhalla = {
|
||||||
|
windows = {
|
||||||
dualboot = {
|
dualboot = {
|
||||||
enable = mkEnableOption "dual boot";
|
enable = mkEnableOption "dual boot";
|
||||||
|
|
||||||
|
@ -18,20 +21,27 @@
|
||||||
description = "The percentage of the disk size reserved for Linux.";
|
description = "The percentage of the disk size reserved for Linux.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
showFileExt = mkOption {
|
||||||
dualboot.linuxPercentage = mkIf (!config.dualboot.enable) 0;
|
type = types.bool;
|
||||||
};
|
description = "A value indicating whether file extensions should be displayed in Windows Explorer.";
|
||||||
});
|
default = true;
|
||||||
in {
|
};
|
||||||
options = {
|
|
||||||
valhalla = {
|
legacyIconSpacing = mkEnableOption "legacy icon spacing" // {
|
||||||
windows = mkOption {
|
default = true;
|
||||||
type = winType;
|
};
|
||||||
description = "The options for setting up Windows.";
|
|
||||||
default = {};
|
dynamicLighting = mkEnableOption "dynamic lighting";
|
||||||
|
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
valhalla.windows = {
|
||||||
|
setupUser.name = mkDefault (capitalize config.valhalla.setupUser.name);
|
||||||
|
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) (mkDefault 0);
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
9
lib/text.nix
Normal file
9
lib/text.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ lib, ... }: {
|
||||||
|
capitalize = text:
|
||||||
|
let
|
||||||
|
chars = lib.strings.stringToCharacters text;
|
||||||
|
in lib.strings.concatStrings (
|
||||||
|
[(lib.strings.toUpper (builtins.elemAt chars 0))] ++
|
||||||
|
(lib.lists.drop 1 chars)
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
function install() {
|
|
||||||
function installDrivers() {
|
|
||||||
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
|
|
||||||
. "../../../scripts/Arch/Software/nvidia-dkms/install.sh";
|
|
||||||
. "../../../scripts/Arch/Software/xone/install.sh";
|
|
||||||
. "../../../scripts/Arch/Software/bt-dualboot/install.sh";
|
|
||||||
}
|
|
||||||
|
|
||||||
function initializeConfig() {
|
|
||||||
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
|
||||||
}
|
|
||||||
|
|
||||||
pushd "$dir" > /dev/null;
|
|
||||||
. "../../../scripts/Arch/OS/install.sh";
|
|
||||||
popd > /dev/null;
|
|
||||||
}
|
|
||||||
|
|
||||||
install;
|
|
|
@ -1,139 +0,0 @@
|
||||||
#!/bin/pwsh
|
|
||||||
$env:WIN_COMPUTER_NAME = "DerGeret";
|
|
||||||
$env:SETUP_SCRIPT_NAME = "$PSScriptRoot/Restore.ps1";
|
|
||||||
|
|
||||||
function Initialize-SetupConfig() {
|
|
||||||
param(
|
|
||||||
[xml] $config,
|
|
||||||
[System.Xml.XmlNamespaceManager] $namespace
|
|
||||||
);
|
|
||||||
|
|
||||||
$setupComponent = $config.SelectSingleNode(
|
|
||||||
"/ua:unattend/ua:settings[@pass='windowsPE']/ua:component[@name='Microsoft-Windows-Setup']",
|
|
||||||
$namespace);
|
|
||||||
|
|
||||||
$diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace);
|
|
||||||
|
|
||||||
$partitionCreationContainer = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace);
|
|
||||||
$partitionCreations = $partitionCreationContainer.SelectNodes("./ua:CreatePartition", $namespace);
|
|
||||||
|
|
||||||
$partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
|
|
||||||
$partitionModifications = $partitionModificationContainer.SelectNodes("./ua:ModifyPartition", $namespace);
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Gets the XML element describing the installation partition ID.
|
|
||||||
#>
|
|
||||||
function Get-InstallationPartition {
|
|
||||||
$setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID", $namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Increases the ID of all partitions in the specified range by 1.
|
|
||||||
#>
|
|
||||||
function Move-PartitionRange {
|
|
||||||
param (
|
|
||||||
[int]$From = 0,
|
|
||||||
[System.Nullable[int]]$To = $null,
|
|
||||||
[int]$By = 1
|
|
||||||
)
|
|
||||||
|
|
||||||
# Update installation partition ID if necessary
|
|
||||||
$installationPartition = Get-InstallationPartition;
|
|
||||||
$installPartitionID = [int]$installationPartition.InnerText;
|
|
||||||
|
|
||||||
if (($installPartitionID -ge $From) -and (($null -eq $To) -or ($installPartitionID -le $To))) {
|
|
||||||
$installationPartition.InnerText = "$($installPartitionID + $By)";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update IDs of all partition creations
|
|
||||||
foreach ($partition in $partitionCreations) {
|
|
||||||
$orderNode = $partition.SelectSingleNode("./ua:Order", $namespace);
|
|
||||||
$order = [int]$orderNode.InnerText;
|
|
||||||
$newOrder = $order;
|
|
||||||
|
|
||||||
if (($newOrder -ge $From) -and (($null -eq $To) -or ($newOrder -le $To))) {
|
|
||||||
$newOrder += $By;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($order -ne $newOrder) {
|
|
||||||
$orderNode.InnerText = "$newOrder";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update IDs of all partition modifications
|
|
||||||
foreach ($partition in $partitionModifications) {
|
|
||||||
$partitionNode = $partition.SelectSingleNode("./ua:PartitionID", $namespace);
|
|
||||||
$partitionID = [int]$partitionNode.InnerText;
|
|
||||||
$newID = $partitionID;
|
|
||||||
|
|
||||||
if (($newID -ge $From) -and (($null -eq $To) -or ($newID -le $To))) {
|
|
||||||
$newID += $By;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($partitionID -ne $newID) {
|
|
||||||
$partitionNode.InnerText = "$newID";
|
|
||||||
$partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newID";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Add-Partition {
|
|
||||||
param (
|
|
||||||
[int]$Index,
|
|
||||||
[int]$Size,
|
|
||||||
[string]$Type = "Primary"
|
|
||||||
)
|
|
||||||
|
|
||||||
Move-PartitionRange -From $Index -By 1;
|
|
||||||
|
|
||||||
$newPartition = $partitionCreations[0].CloneNode($true);
|
|
||||||
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$Index";
|
|
||||||
$newPartition.SelectSingleNode("./ua:Type", $namespace).InnerText = "$Type";
|
|
||||||
$newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "$Size";
|
|
||||||
$null = $partitionCreationContainer.AppendChild($newPartition);
|
|
||||||
|
|
||||||
$newModification = $partitionModifications[2].CloneNode($true);
|
|
||||||
$newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$Index";
|
|
||||||
$newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$Index";
|
|
||||||
$null = $partitionModificationContainer.AppendChild($newModification);
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Relocates the partition with the specified `$From` ID to the specified `$To` ID.
|
|
||||||
#>
|
|
||||||
function Invoke-PartitionRelocation {
|
|
||||||
param (
|
|
||||||
[int]$From,
|
|
||||||
[int]$To
|
|
||||||
)
|
|
||||||
|
|
||||||
Move-PartitionRange $From $From (-1 * ($From + 1))
|
|
||||||
|
|
||||||
if ($From -gt $To) {
|
|
||||||
Move-PartitionRange $To ($From - 1);
|
|
||||||
}
|
|
||||||
elseif ($From -lt $To) {
|
|
||||||
Move-PartitionRange ($From + 1) $To -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Move-PartitionRange -1 -1 ($To + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Resize EFI partition to 1GB
|
|
||||||
$partitionCreations[1].SelectSingleNode("./ua:Size", $namespace).InnerText = "$(1024)";
|
|
||||||
|
|
||||||
# Swap Windows RE partition (partition #1) and boot partition (partition #2)
|
|
||||||
Invoke-PartitionRelocation 2 1;
|
|
||||||
|
|
||||||
# Add space before Windows installation... wha-!? For Linux, ofc! I use Arch Linux, btw.
|
|
||||||
$swapSpacer = 100;
|
|
||||||
Add-Partition 2 $swapSpacer;
|
|
||||||
|
|
||||||
# Add a 1.2 TB partition for Linux
|
|
||||||
Add-Partition 3 ((1.2 * 1024 * 1024) - 1024 - $swapSpacer);
|
|
||||||
}
|
|
||||||
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
|
|
@ -1,20 +0,0 @@
|
||||||
{ ... }: {
|
|
||||||
imports = [
|
|
||||||
../Generic/config.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
|
||||||
valhalla.partition.os.partitions = {
|
|
||||||
Boot.keepExisting = true;
|
|
||||||
|
|
||||||
Windows = {
|
|
||||||
index = 6;
|
|
||||||
label = "OS";
|
|
||||||
format = "ntfs";
|
|
||||||
mountPoint = "/win";
|
|
||||||
mountOptions = ["force"];
|
|
||||||
keepExisting = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/pwsh
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Collections/Generic.ps1"
|
|
||||||
|
|
||||||
function Restore-Apps {
|
|
||||||
param([Context] $context)
|
|
||||||
Restore-GenericApps $context;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Context]$context = [Context]::new();
|
|
||||||
Invoke-WindowsInstallation $context;
|
|
||||||
Restart-Computer -Force;
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/pwsh
|
|
||||||
$env:WIN_COMPUTER_NAME ??= "win11";
|
|
||||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
|
||||||
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
|
||||||
|
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/pwsh
|
|
||||||
$env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
|
|
||||||
|
|
||||||
. "$PSScriptRoot/../../Generic/Windows/Setup.ps1";
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/env fish
|
|
||||||
begin
|
|
||||||
set -l dir (status dirname)
|
|
||||||
source "$dir/../../../scripts/Arch/OS/install.fish"
|
|
||||||
end
|
|
|
@ -1,26 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
function install() {
|
|
||||||
function installDrivers() {
|
|
||||||
. "../../../scripts/Arch/Config/SecureBoot/install.sh";
|
|
||||||
. "../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
|
|
||||||
}
|
|
||||||
|
|
||||||
function installSoftware() {
|
|
||||||
. "../../../scripts/Arch/Collections/school.sh";
|
|
||||||
}
|
|
||||||
|
|
||||||
function initializeConfig() {
|
|
||||||
. "../../../scripts/Common/Config/Steam/hidpi.sh";
|
|
||||||
. "../../../scripts/Unix/Devices/Surface Book 2/install.sh";
|
|
||||||
. "../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
|
||||||
|
|
||||||
# Because, as it looks, Surface Books are fucking stupid.
|
|
||||||
. "../../../scripts/Common/Config/GRUB/verbose.sh";
|
|
||||||
}
|
|
||||||
|
|
||||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
||||||
. "../../../scripts/Arch/OS/install.sh";
|
|
||||||
popd > /dev/null;
|
|
||||||
}
|
|
||||||
|
|
||||||
install;
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
||||||
# Set Hostname
|
|
||||||
sudo hostnamectl set-hostname ManuSurface;
|
|
||||||
|
|
||||||
source "../../../scripts/PopOS/Scripts/preinstall.sh";
|
|
||||||
source "../../../scripts/PopOS/OS/install.sh";
|
|
||||||
source "../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
|
|
||||||
source "../../../scripts/PopOS/Software/Collections/school.sh";
|
|
||||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../scripts/Common/Config/UserProfile/install.sh";
|
|
||||||
|
|
||||||
# Install equalizer
|
|
||||||
source "../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
|
|
||||||
|
|
||||||
source "../../../scripts/PopOS/Scripts/postinstall.sh";
|
|
||||||
popd > /dev/null;
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
|
||||||
|
|
||||||
# Set Hostname
|
|
||||||
sudo hostnamectl set-hostname ManuPopOSLive;
|
|
||||||
source "../../scripts/PopOS/Scripts/prepare.sh";
|
|
||||||
source "../../scripts/PopOS/OS/install.sh";
|
|
||||||
source "../../scripts/PopOS/Software/Collections/personal.sh";
|
|
||||||
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../scripts/Common/Config/UserProfile/personal.sh";
|
|
||||||
|
|
||||||
source "../../scripts/PopOS/Scripts/postinstall.sh";
|
|
||||||
popd > /dev/null;
|
|
19
profiles/machines/manuel/DerGeret/Arch/install.sh
Executable file
19
profiles/machines/manuel/DerGeret/Arch/install.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
function install() {
|
||||||
|
function installDrivers() {
|
||||||
|
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||||
|
. "../../../../../scripts/Arch/Software/nvidia-dkms/install.sh";
|
||||||
|
. "../../../../../scripts/Arch/Software/xone/install.sh";
|
||||||
|
. "../../../../../scripts/Arch/Software/bt-dualboot/install.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeConfig() {
|
||||||
|
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd "$dir" > /dev/null;
|
||||||
|
. "../../../../../scripts/Arch/OS/install.sh";
|
||||||
|
popd > /dev/null;
|
||||||
|
}
|
||||||
|
|
||||||
|
install;
|
|
@ -6,8 +6,8 @@ begin
|
||||||
echo "$dir/install.fish"
|
echo "$dir/install.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
CONFIG_MODULE="$dir/config.nix" \
|
CONFIG_NAME="DerGeret" \
|
||||||
ARCH_HOSTNAME="der-geret" \
|
ARCH_HOSTNAME="der-geret" \
|
||||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||||
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish"
|
source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish"
|
||||||
end
|
end
|
|
@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
CONFIG_MODULE="./config.nix" \
|
CONFIG_MODULE="./config.nix" \
|
||||||
ARCH_HOSTNAME="der-geret" \
|
ARCH_HOSTNAME="der-geret" \
|
||||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||||
. "../../../scripts/Arch/OS/setup.sh";
|
. "../../../../../scripts/Arch/OS/setup.sh";
|
||||||
|
|
||||||
popd > /dev/null;
|
popd > /dev/null;
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Manage.ps1";
|
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Legacy.ps1";
|
||||||
|
|
||||||
Write-Host "Starting Backup of Windows";
|
Write-Host "Starting Backup of Windows";
|
||||||
$context = [Context]::new();
|
$context = [Context]::new();
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||||
|
|
||||||
function Install-PortValhallaDrivers {
|
function Install-PortValhallaDrivers {
|
||||||
param(
|
param(
|
||||||
[Context] $context
|
[Context] $context
|
||||||
)
|
)
|
||||||
|
|
||||||
$winPath = "$PSScriptRoot/../../../scripts/Windows";
|
$winPath = "$PSScriptRoot/../../../../../scripts/Windows";
|
||||||
$driverPath = "$winPath/Drivers";
|
$driverPath = "$winPath/Drivers";
|
||||||
$mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha";
|
$mbDriverPath = "$driverPath/ROG Zenith Extreme Alpha";
|
||||||
$context.RegisterReboot();
|
$context.RegisterReboot();
|
||||||
|
@ -38,7 +38,7 @@ function Install-PersonalDrivers {
|
||||||
[Context] $context
|
[Context] $context
|
||||||
)
|
)
|
||||||
|
|
||||||
$softwarePath = "$PSScriptRoot/../../../scripts/Windows/Software";
|
$softwarePath = "$PSScriptRoot/../../../../../scripts/Windows/Software";
|
||||||
. "$softwarePath/TobiiGhost/Install.ps1" $context;
|
. "$softwarePath/TobiiGhost/Install.ps1" $context;
|
||||||
. "$softwarePath/TobiiGameHub/Install.ps1" $context;
|
. "$softwarePath/TobiiGameHub/Install.ps1" $context;
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/Drivers.ps1";
|
. "$PSScriptRoot/Drivers.ps1";
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Collections/Personal.ps1"
|
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Personal.ps1"
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
|
||||||
|
|
||||||
function Initialize-Configuration {
|
function Initialize-Configuration {
|
||||||
# Fix synchronization between Linux and Windows clock
|
# Fix synchronization between Linux and Windows clock
|
||||||
|
@ -26,5 +26,4 @@ function Restore-Apps {
|
||||||
|
|
||||||
Write-Host "Starting Restoration of Windows";
|
Write-Host "Starting Restoration of Windows";
|
||||||
[Context]$context = [Context]::new();
|
[Context]$context = [Context]::new();
|
||||||
Invoke-WindowsInstallation $context;
|
Start-WindowsInstallation;
|
||||||
Restart-Computer -Force;
|
|
5
profiles/machines/manuel/DerGeret/Windows/Setup.ps1
Normal file
5
profiles/machines/manuel/DerGeret/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/pwsh
|
||||||
|
$env:WIN_COMPUTER_NAME = "DerGeret";
|
||||||
|
$env:CONFIG_NAME = $env:WIN_COMPUTER_NAME;
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";
|
48
profiles/machines/manuel/DerGeret/config.nix
Normal file
48
profiles/machines/manuel/DerGeret/config.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{ ... }: {
|
||||||
|
imports = [
|
||||||
|
../defaults.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
valhalla = {
|
||||||
|
windows = {
|
||||||
|
dualboot = {
|
||||||
|
enable = true;
|
||||||
|
linuxPercentage = 70; # better safe than sorry
|
||||||
|
};
|
||||||
|
|
||||||
|
users.manuel = {
|
||||||
|
microsoftAccount = true;
|
||||||
|
groups = ["Administrators"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
partition.os.partitions = {
|
||||||
|
Boot.keepExisting = true;
|
||||||
|
|
||||||
|
Windows = {
|
||||||
|
index = 6;
|
||||||
|
label = "OS";
|
||||||
|
format = "ntfs";
|
||||||
|
mountPoint = "/win";
|
||||||
|
mountOptions = ["force"];
|
||||||
|
keepExisting = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hardware = {
|
||||||
|
components = [
|
||||||
|
"ROG Zenith Extreme Alpha"
|
||||||
|
"Predator Z301C"
|
||||||
|
];
|
||||||
|
|
||||||
|
eyeX = true;
|
||||||
|
amdCPU = true;
|
||||||
|
nvidiaGPU = true;
|
||||||
|
logitechG = true;
|
||||||
|
corsairDevice = true;
|
||||||
|
elgatoWave = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,11 +3,11 @@ function install() {
|
||||||
local dir="$(realpath "${BASH_SOURCE%/*}")";
|
local dir="$(realpath "${BASH_SOURCE%/*}")";
|
||||||
|
|
||||||
function installDrivers() {
|
function installDrivers() {
|
||||||
. "$dir/../../../scripts/Arch/Config/SecureBoot/install.sh";
|
. "$dir/../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
. "../../../scripts/Arch/OS/install.sh";
|
. "../../../../../scripts/Arch/OS/install.sh";
|
||||||
}
|
}
|
||||||
|
|
||||||
install;
|
install;
|
|
@ -4,6 +4,6 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
ARCH_MOUNT_ROOT="/mnt" \
|
ARCH_MOUNT_ROOT="/mnt" \
|
||||||
ARCH_HOSTNAME="archlinux" \
|
ARCH_HOSTNAME="archlinux" \
|
||||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||||
. "../../../scripts/Arch/OS/setup.sh";
|
. "../../../../../scripts/Arch/OS/setup.sh";
|
||||||
|
|
||||||
popd > /dev/null;
|
popd > /dev/null;
|
13
profiles/machines/manuel/Generic/Windows/Install.ps1
Normal file
13
profiles/machines/manuel/Generic/Windows/Install.ps1
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/pwsh
|
||||||
|
. "$PSScriptRoot/../../../../../scripts/Common/Scripts/Context.ps1";
|
||||||
|
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Manage.ps1";
|
||||||
|
. "$PSScriptRoot/../../../../../scripts/Windows/Collections/Generic.ps1"
|
||||||
|
|
||||||
|
function Restore-Apps {
|
||||||
|
param([Context] $context)
|
||||||
|
Restore-GenericApps $context;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Context]$context = [Context]::new();
|
||||||
|
Invoke-WindowsInstallation $context;
|
||||||
|
Restart-Computer -Force;
|
5
profiles/machines/manuel/Generic/Windows/Setup.ps1
Normal file
5
profiles/machines/manuel/Generic/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/pwsh
|
||||||
|
$env:WIN_COMPUTER_NAME ??= "win11";
|
||||||
|
$env:CONFIG_MODULE ??= "$PSScriptRoot/../config.nix";
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../../../../../scripts/Windows/OS/Setup.ps1";
|
|
@ -1,9 +1,9 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
fs = import ../../lib/modules/partition/fs.nix;
|
fs = import ../../../../lib/modules/partition/fs.nix;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
../../lib/modules/valhalla.nix
|
../defaults.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -35,31 +35,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
users = {
|
|
||||||
manuel = {
|
|
||||||
displayName = "Manuel Thalmann";
|
|
||||||
mailAddress = "m@nuth.ch";
|
|
||||||
|
|
||||||
groups = [
|
|
||||||
"wheel"
|
|
||||||
"nix-users"
|
|
||||||
];
|
|
||||||
|
|
||||||
defaultShell = "fish";
|
|
||||||
|
|
||||||
rclone = {
|
|
||||||
configurations = {
|
|
||||||
nextcloud = {
|
|
||||||
dirName = "Nextcloud";
|
|
||||||
};
|
|
||||||
proton = {
|
|
||||||
dirName = "Proton";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
timeZone = "Europe/Zurich";
|
timeZone = "Europe/Zurich";
|
||||||
keyMap = "de_CH-latin1";
|
keyMap = "de_CH-latin1";
|
||||||
keyboardLayout = "ch";
|
keyboardLayout = "ch";
|
|
@ -14,4 +14,4 @@ function Install-PortValhallaDrivers {
|
||||||
choco install -y spice-agent;
|
choco install -y spice-agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
. "$PSScriptRoot/../../Generic/Windows/Install.ps1";
|
. "$PSScriptRoot/../../../../Generic/Windows/Install.ps1";
|
2
profiles/machines/manuel/KVM/Windows/Setup.ps1
Normal file
2
profiles/machines/manuel/KVM/Windows/Setup.ps1
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/pwsh
|
||||||
|
. "$PSScriptRoot/../../../../Generic/Windows/Setup.ps1";
|
5
profiles/machines/manuel/ManuSurface/Arch/install.fish
Executable file
5
profiles/machines/manuel/ManuSurface/Arch/install.fish
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/env fish
|
||||||
|
begin
|
||||||
|
set -l dir (status dirname)
|
||||||
|
source "$dir/../../../../../scripts/Arch/OS/install.fish"
|
||||||
|
end
|
26
profiles/machines/manuel/ManuSurface/Arch/install.sh
Executable file
26
profiles/machines/manuel/ManuSurface/Arch/install.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
function install() {
|
||||||
|
function installDrivers() {
|
||||||
|
. "../../../../../scripts/Arch/Config/SecureBoot/install.sh";
|
||||||
|
. "../../../../../scripts/Arch/Drivers/SurfaceBook2/install.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
function installSoftware() {
|
||||||
|
. "../../../../../scripts/Arch/Collections/school.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeConfig() {
|
||||||
|
. "../../../../../scripts/Common/Config/Steam/hidpi.sh";
|
||||||
|
. "../../../../../scripts/Unix/Devices/Surface Book 2/install.sh";
|
||||||
|
. "../../../../../scripts/Unix/Devices/Logitech G903/install.sh";
|
||||||
|
|
||||||
|
# Because, as it looks, Surface Books are fucking stupid.
|
||||||
|
. "../../../../../scripts/Common/Config/GRUB/verbose.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
|
. "../../../../../scripts/Arch/OS/install.sh";
|
||||||
|
popd > /dev/null;
|
||||||
|
}
|
||||||
|
|
||||||
|
install;
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
|
|
||||||
function installDrivers -V dir -S
|
function installDrivers -V dir -S
|
||||||
source "$dir/../../../scripts/Common/Scripts/config.fish"
|
source "$dir/../../../../../scripts/Common/Scripts/config.fish"
|
||||||
pacstrap -K (getConfig valhalla.partition.rootDir) linux-firmware-marvell;
|
pacstrap -K (getConfig valhalla.partition.rootDir) linux-firmware-marvell;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ begin
|
||||||
echo "$dir/install.fish"
|
echo "$dir/install.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
CONFIG_MODULE="$(status dirname)/config.nix" \
|
CONFIG_NAME="ManuSurface" \
|
||||||
ARCH_HOSTNAME="manu-surface" \
|
ARCH_HOSTNAME="manu-surface" \
|
||||||
USER_DISPLAYNAME="Manuel Thalmann" \
|
USER_DISPLAYNAME="Manuel Thalmann" \
|
||||||
source "$(status dirname)/../../../scripts/Arch/OS/setup.fish";
|
source "$(status dirname)/../../../../../scripts/Arch/OS/setup.fish";
|
||||||
end
|
end
|
16
profiles/machines/manuel/ManuSurface/PopOS/setup.sh
Executable file
16
profiles/machines/manuel/ManuSurface/PopOS/setup.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
|
# Set Hostname
|
||||||
|
sudo hostnamectl set-hostname ManuSurface;
|
||||||
|
|
||||||
|
source "../../../../../scripts/PopOS/Scripts/preinstall.sh";
|
||||||
|
source "../../../../../scripts/PopOS/OS/install.sh";
|
||||||
|
source "../../../../../scripts/Debian/Drivers/SurfaceBook2/Setup/install.sh";
|
||||||
|
source "../../../../../scripts/PopOS/Software/Collections/school.sh";
|
||||||
|
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../../scripts/Common/Config/UserProfile/install.sh";
|
||||||
|
|
||||||
|
# Install equalizer
|
||||||
|
source "../../../../../scripts/Common/Config/EasyEffects/SurfaceBook2/install.sh";
|
||||||
|
|
||||||
|
source "../../../../../scripts/PopOS/Scripts/postinstall.sh";
|
||||||
|
popd > /dev/null;
|
12
profiles/machines/manuel/PopOSLive/setup.sh
Executable file
12
profiles/machines/manuel/PopOSLive/setup.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
pushd "${BASH_SOURCE%/*}" > /dev/null;
|
||||||
|
|
||||||
|
# Set Hostname
|
||||||
|
sudo hostnamectl set-hostname ManuPopOSLive;
|
||||||
|
source "../../../../scripts/PopOS/Scripts/prepare.sh";
|
||||||
|
source "../../../../scripts/PopOS/OS/install.sh";
|
||||||
|
source "../../../../scripts/PopOS/Software/Collections/personal.sh";
|
||||||
|
INSTALL_FONTS=1 NEXTCLOUD_DIR="${NEXTCLOUD_DIR}" source "../../../../scripts/Common/Config/UserProfile/personal.sh";
|
||||||
|
|
||||||
|
source "../../../../scripts/PopOS/Scripts/postinstall.sh";
|
||||||
|
popd > /dev/null;
|
6
profiles/machines/manuel/defaults.nix
Normal file
6
profiles/machines/manuel/defaults.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{ ... }: {
|
||||||
|
imports = [
|
||||||
|
../../users/manuel/config.nix
|
||||||
|
../../../lib/modules/valhalla.nix
|
||||||
|
];
|
||||||
|
}
|
66
profiles/users/manuel/config.nix
Normal file
66
profiles/users/manuel/config.nix
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{ ... }: {
|
||||||
|
imports = [
|
||||||
|
../../../lib/modules/valhalla.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
valhalla = {
|
||||||
|
users.manuel = {
|
||||||
|
displayName = "Manuel Thalmann";
|
||||||
|
mailAddress = "m@nuth.ch";
|
||||||
|
|
||||||
|
oh-my-posh = {
|
||||||
|
theme = {
|
||||||
|
source = ./manuel.omp.json;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
linux.users.manuel = {
|
||||||
|
defaultShell = "fish";
|
||||||
|
|
||||||
|
groups = [
|
||||||
|
"wheel"
|
||||||
|
"nix-users"
|
||||||
|
];
|
||||||
|
|
||||||
|
rclone = {
|
||||||
|
configurations = {
|
||||||
|
nextcloud = {
|
||||||
|
dirName = "Nextcloud";
|
||||||
|
};
|
||||||
|
proton = {
|
||||||
|
dirName = "Proton";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
windows.users.manuel = {
|
||||||
|
nextcloud = {
|
||||||
|
folderSyncs =
|
||||||
|
let
|
||||||
|
localPath = "C:/tools/RetroArch-Win64";
|
||||||
|
remotePath = "/Saved Games/RetroArch";
|
||||||
|
in [
|
||||||
|
{
|
||||||
|
remotePath = "${remotePath}/Saves";
|
||||||
|
localPath = "${localPath}/saves";
|
||||||
|
virtualFiles = false;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
remotePath = "${remotePath}/System";
|
||||||
|
localPath = "${localPath}/system";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
partition = {
|
||||||
|
os = {
|
||||||
|
partitions = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
173
profiles/users/manuel/manuel.omp.json
Normal file
173
profiles/users/manuel/manuel.omp.json
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||||
|
"version": 2,
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"type": "prompt",
|
||||||
|
"alignment": "left",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"type": "os",
|
||||||
|
"style": "diamond",
|
||||||
|
"leading_diamond": "\ue0b6",
|
||||||
|
"trailing_diamond": "\ue0b4",
|
||||||
|
"background_templates": [
|
||||||
|
"{{ if eq .OS \"ubuntu\" }}#EA531A{{ end }}",
|
||||||
|
"{{ if eq .OS \"debian\" }}#D80150{{ end }}",
|
||||||
|
"{{ if eq .OS \"arch\" }}#1793D1{{ end }}"
|
||||||
|
],
|
||||||
|
"foreground": "p:white",
|
||||||
|
"template": "{{ if ne .OS \"windows\" }}{{ .Icon }} {{ end }}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "session",
|
||||||
|
"style": "diamond",
|
||||||
|
"leading_diamond": "\ue0b6",
|
||||||
|
"trailing_diamond": "\ue0b0",
|
||||||
|
"background": "p:yellow",
|
||||||
|
"foreground": "p:black",
|
||||||
|
"properties": {
|
||||||
|
"display_host": false
|
||||||
|
},
|
||||||
|
"template": " {{ if .SSHSession }}\ueb39 {{ end }}{{ .UserName }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "p:orange",
|
||||||
|
"foreground": "p:black",
|
||||||
|
"properties": {
|
||||||
|
"home_icon": "~",
|
||||||
|
"style": "folder"
|
||||||
|
},
|
||||||
|
"template": " \udb80\ude4b {{ path .Path .Location }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "dotnet",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"foreground": "p:black",
|
||||||
|
"background": "#00ffff",
|
||||||
|
"template": " \udb81\ude10 {{ .Full }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "#4063d8",
|
||||||
|
"template": " \udb82\udf37 {{ .Full }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "python",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "#906cff",
|
||||||
|
"template": " \udb80\udf20 {{ .Full }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"trailing_diamond": "\ue0b4",
|
||||||
|
"background": "p:green",
|
||||||
|
"background_templates": [
|
||||||
|
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
|
||||||
|
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
|
||||||
|
"{{ if gt .Ahead 0 }}#49416D{{ end }}",
|
||||||
|
"{{ if gt .Behind 0 }}#7A306C{{ end }}"
|
||||||
|
],
|
||||||
|
"foreground": "p:black",
|
||||||
|
"foreground_templates": [
|
||||||
|
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
|
||||||
|
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
|
||||||
|
"{{ if gt .Ahead 0 }}p:white{{ end }}"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"branch_max_length": 25,
|
||||||
|
"fetch_stash_count": true,
|
||||||
|
"fetch_status": true,
|
||||||
|
"fetch_upstream_icon": true,
|
||||||
|
"upstream_icons": {
|
||||||
|
"codeberg.org": "\uf330 ",
|
||||||
|
"git.nuth.ch": "\uf335",
|
||||||
|
"git.jonascosta.ch": "\uf339 ",
|
||||||
|
"git.romhackersworld.eu": "\uf339 ",
|
||||||
|
"aur.archlinux.org": "\uf303 "
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"templates": [
|
||||||
|
"{{ if .UpstreamURL }} {{ url .UpstreamIcon .UpstreamURL }}{{ end }}",
|
||||||
|
" {{ .HEAD }} ",
|
||||||
|
"{{ if .BranchStatus }}{{ .BranchStatus }} {{ end }}",
|
||||||
|
"{{ if .Working.Changed }} \uf044 {{ .Working.String }} {{ end }}",
|
||||||
|
"{{ if and (.Working.Changed) (or (.Staging.Changed) (gt .StashCount 0)) }} | {{ end }}",
|
||||||
|
"{{ if .Staging.Changed }} \uf046 {{ .Staging.String }} {{ end }}",
|
||||||
|
"{{ if and (.Staging.Changed) (gt .StashCount 0) }} | {{ end }}",
|
||||||
|
"{{ if gt .StashCount 0 }} \udb80\udd93 {{ .StashCount }}{{ end }} "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "#6ca35e",
|
||||||
|
"foreground": "p:white",
|
||||||
|
"properties": {
|
||||||
|
"fetch_version": true
|
||||||
|
},
|
||||||
|
"template": " \udb80\udf99 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "root",
|
||||||
|
"style": "powerline",
|
||||||
|
"powerline_symbol": "\ue0b0",
|
||||||
|
"background": "p:yellow",
|
||||||
|
"foreground": "p:white",
|
||||||
|
"properties": {
|
||||||
|
"root_icon": "\uf0e7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "executiontime",
|
||||||
|
"style": "plain",
|
||||||
|
"background": "#83769c",
|
||||||
|
"foreground": "p:white",
|
||||||
|
"properties": {
|
||||||
|
"always_enabled": true
|
||||||
|
},
|
||||||
|
"template": "<transparent>\ue0b0</> \udb81\udead {{ .FormattedMs }}\u2800"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"style": "diamond",
|
||||||
|
"background": "p:blue",
|
||||||
|
"trailing_diamond": "\ue0b4",
|
||||||
|
"background_templates": [
|
||||||
|
"{{ if gt .Code 0 }}p:red{{ end }}"
|
||||||
|
],
|
||||||
|
"foreground": "p:white",
|
||||||
|
"properties": {
|
||||||
|
"always_enabled": true
|
||||||
|
},
|
||||||
|
"template": "<parentBackground>\ue0b0</> {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"transient_prompt": {
|
||||||
|
"background": "transparent",
|
||||||
|
"foreground": "p:black",
|
||||||
|
"template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
|
||||||
|
},
|
||||||
|
"final_space": true,
|
||||||
|
"palette": {
|
||||||
|
"black": "#262B44",
|
||||||
|
"blue": "#4B95E9",
|
||||||
|
"green": "#59C9A5",
|
||||||
|
"orange": "#F07623",
|
||||||
|
"red": "#D81E5B",
|
||||||
|
"white": "#E0DEF4",
|
||||||
|
"yellow": "#F3AE35"
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,7 +68,7 @@ begin
|
||||||
end | begin
|
end | begin
|
||||||
read LOCALES
|
read LOCALES
|
||||||
and arch-chroot "$mountDir" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen
|
and arch-chroot "$mountDir" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen
|
||||||
and locale-gen
|
and arch-chroot "$mountDir" locale-gen
|
||||||
end
|
end
|
||||||
|
|
||||||
and begin
|
and begin
|
||||||
|
|
|
@ -3,11 +3,19 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
source "$dir/../../Common/Scripts/software.fish"
|
source "$dir/../../Common/Scripts/software.fish"
|
||||||
|
|
||||||
|
function runYay -d "Run yay with pre-configured defaults"
|
||||||
|
yay --needed --answerclean=None --answerdiff=None -Syu $argv
|
||||||
|
end
|
||||||
|
|
||||||
function yayinst -d "Install yay-package non-interactively"
|
function yayinst -d "Install yay-package non-interactively"
|
||||||
yay --noconfirm --needed --answerclean=None --answerdiff=None -Syu $argv
|
runYay --noconfirm $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function runPacman -d "Run pacman with pre-configured defaults"
|
||||||
|
sudo pacman --needed -Syu $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function pacinst -d "Install pacman-package non-interactively"
|
function pacinst -d "Install pacman-package non-interactively"
|
||||||
sudo pacman --noconfirm --needed -Syu $argv
|
runPacman --noconfirm $argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,12 +5,12 @@ begin
|
||||||
|
|
||||||
function installSW
|
function installSW
|
||||||
yayinst qemu-full
|
yayinst qemu-full
|
||||||
|
yes | runPacman --asdeps iptables-nft
|
||||||
|
|
||||||
yes | yayinst \
|
yes | yayinst \
|
||||||
virtiofsd \
|
virtiofsd \
|
||||||
virt-manager \
|
virt-manager \
|
||||||
dnsmasq \
|
dnsmasq \
|
||||||
iptables-nft \
|
|
||||||
swtpm \
|
swtpm \
|
||||||
lxc \
|
lxc \
|
||||||
virt-bootstrap-git
|
virt-bootstrap-git
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst \
|
yayinst \
|
||||||
aliae-bin
|
aliae-bin
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ begin
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
source "$dir/../../../Common/Software/brave/main.fish"
|
source "$dir/../../../Common/Software/brave/main.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst brave-bin (
|
yayinst brave-bin (
|
||||||
# brave-beta-bin
|
# brave-beta-bin
|
||||||
# brave-nightly-bin
|
# brave-nightly-bin
|
||||||
|
|
|
@ -4,7 +4,7 @@ begin
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
source "$dir/../../../Common/Software/git/main.fish"
|
source "$dir/../../../Common/Software/git/main.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst \
|
yayinst \
|
||||||
git \
|
git \
|
||||||
git-lfs \
|
git-lfs \
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst grub-theme-minegrub-git
|
yayinst grub-theme-minegrub-git
|
||||||
fish "$dir/../../../Common/Software/minegrub-theme/main.fish" configure
|
fish "$dir/../../../Common/Software/minegrub-theme/main.fish" configure
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ begin
|
||||||
|
|
||||||
function installSW -V dir
|
function installSW -V dir
|
||||||
yayinst nodejs-n
|
yayinst nodejs-n
|
||||||
sudo fish "$dir/../../../Common/Software/n/main.fish" configure
|
sudo --preserve-env --set-home fish "$dir/../../../Common/Software/n/main.fish" configure
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -7,10 +7,12 @@ begin
|
||||||
yayinst \
|
yayinst \
|
||||||
openssh \
|
openssh \
|
||||||
libfido2
|
libfido2
|
||||||
|
|
||||||
|
source (status filename) configure
|
||||||
end
|
end
|
||||||
|
|
||||||
function configureSW
|
function configureSW
|
||||||
systemctl --global enable --now ssh-agent
|
sudo systemctl --global enable ssh-agent
|
||||||
|
|
||||||
and begin
|
and begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst pyenv
|
yayinst pyenv
|
||||||
fish "$dir/../../../Common/Software/pyenv/main.fish" configure
|
fish "$dir/../../../Common/Software/pyenv/main.fish" configure
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ begin
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
source "$dir/../../../Common/Software/vim/main.fish"
|
source "$dir/../../../Common/Software/vim/main.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst (
|
yayinst (
|
||||||
# Necessary for accessing clipboard in terminal: https://wiki.archlinux.org/title/Vim
|
# Necessary for accessing clipboard in terminal: https://wiki.archlinux.org/title/Vim
|
||||||
) gvim \
|
) gvim \
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function installSW
|
function installSW -V dir
|
||||||
yayinst \
|
yayinst \
|
||||||
zoxide
|
zoxide
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||||
|
|
||||||
Add-PowerShellProfileStatement `
|
Add-PowerShellProfileStatement `
|
||||||
-System `
|
-System `
|
||||||
-Category "oh-my-posh" `
|
-Category "oh-my-posh" `
|
||||||
-Statement $(
|
-Script $(
|
||||||
@(
|
@(
|
||||||
"# Oh My Posh!",
|
"# Oh My Posh!",
|
||||||
$(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
$(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||||
|
|
||||||
foreach ($defaultUser in @($true, $false)) {
|
foreach ($defaultUser in @($true, $false)) {
|
||||||
Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Statement "# aliae`naliae init pwsh | Invoke-Expression";
|
Add-PowerShellProfileStatement -DefaultUser:$defaultUser -Script "# aliae`naliae init pwsh | Invoke-Expression";
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-PowerShellProfileStatement -System -Category "aliae" -Statement "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")";
|
Add-PowerShellProfileStatement -System -Category "aliae" -Script "# aliae`n$(Get-ScriptInitializer "aliae completion powershell")";
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/../../Software/powershell/profile.ps1";
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||||
|
|
||||||
Add-PowerShellProfileStatement `
|
Add-PowerShellProfileStatement `
|
||||||
-System `
|
-System `
|
||||||
-Category "zoxide" `
|
-Category "zoxide" `
|
||||||
-Statement $(
|
-Script $(
|
||||||
@(
|
@(
|
||||||
"# zoxide",
|
"# zoxide",
|
||||||
$(Get-ScriptInitializer "zoxide init powershell | Out-String")
|
$(Get-ScriptInitializer "zoxide init powershell | Out-String")
|
||||||
|
|
|
@ -6,6 +6,7 @@ source "$dir/../Scripts/hooks.fish"
|
||||||
if [ (id -u) -eq 0 ]
|
if [ (id -u) -eq 0 ]
|
||||||
set -l name (getConfig valhalla.setupUser.name)
|
set -l name (getConfig valhalla.setupUser.name)
|
||||||
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
||||||
|
rm ~/.bash_profile
|
||||||
|
|
||||||
runHook createUser || \
|
runHook createUser || \
|
||||||
begin
|
begin
|
||||||
|
@ -23,7 +24,7 @@ if [ (id -u) -eq 0 ]
|
||||||
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
||||||
end > "$sudoConfig"
|
end > "$sudoConfig"
|
||||||
|
|
||||||
and sudo --preserve-env="CONFIG_MODULE" --user "$name" "$INSTALLER_SCRIPT"
|
and sudo --preserve-env="CONFIG_NAME" --user "$name" "$INSTALLER_SCRIPT"
|
||||||
rm "$sudoConfig"
|
rm "$sudoConfig"
|
||||||
userdel -r "$name"
|
userdel -r "$name"
|
||||||
else
|
else
|
||||||
|
|
|
@ -39,7 +39,7 @@ function runSetup
|
||||||
function wrapScript -S
|
function wrapScript -S
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"cd $PROJECT_CLONE_ROOT" \
|
"cd $PROJECT_CLONE_ROOT" \
|
||||||
"export CONFIG_MODULE=$(string escape (getCloneFile "$CONFIG_MODULE"))" \
|
"export CONFIG_NAME=$(string escape (getCloneFile "$CONFIG_NAME"))" \
|
||||||
"$argv"
|
"$argv"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
163
scripts/Common/Scripts/BrowserAutomation.ps1
Normal file
163
scripts/Common/Scripts/BrowserAutomation.ps1
Normal file
|
@ -0,0 +1,163 @@
|
||||||
|
#!/bin/bash
|
||||||
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/System.ps1";
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Runs an action involving browser automation.
|
||||||
|
|
||||||
|
.PARAMETER Action
|
||||||
|
The action to execute.
|
||||||
|
#>
|
||||||
|
function Start-BrowserAutomation {
|
||||||
|
param(
|
||||||
|
[scriptblock] $Action
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
|
||||||
|
$packageRoot = Split-Path -Parent (Get-Package Selenium.WebDriver).Source;
|
||||||
|
$file = Join-Path $packageRoot "lib/netstandard2.0/WebDriver.dll";
|
||||||
|
$env:SE_MANAGER_PATH = Join-Path $packageRoot "manager" ($IsWindows ? "windows" : "linux") "selenium-manager$($IsWindows ? ".exe" : '')";
|
||||||
|
$null = [System.Reflection.Assembly]::LoadFile($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
& $Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Downloads a file from the specified url using browser automation.
|
||||||
|
|
||||||
|
.PARAMETER URL
|
||||||
|
The url to download the file from.
|
||||||
|
|
||||||
|
.PARAMETER Action
|
||||||
|
The action to execute in the browser for initiating the download.
|
||||||
|
|
||||||
|
.PARAMETER OutDir
|
||||||
|
The directory to download the file to.
|
||||||
|
#>
|
||||||
|
function Start-CustomBrowserDownload {
|
||||||
|
param(
|
||||||
|
[string] $URL,
|
||||||
|
[scriptblock] $Action,
|
||||||
|
[string] $OutDir
|
||||||
|
)
|
||||||
|
|
||||||
|
$downloadAction = $Action;
|
||||||
|
|
||||||
|
Start-BrowserAutomation {
|
||||||
|
if (-not $OutDir) {
|
||||||
|
$OutDir = ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir = New-TemporaryDirectory;
|
||||||
|
Write-Host "Downloading ``$URL`` using browser automation…";
|
||||||
|
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
|
||||||
|
$options.SetPreference("browser.download.folderList", 2);
|
||||||
|
$options.SetPreference("browser.download.dir", "$dir");
|
||||||
|
|
||||||
|
$downloadChecker = {
|
||||||
|
$files = Get-ChildItem $dir;
|
||||||
|
|
||||||
|
if ((@($files)).Count -eq 1) {
|
||||||
|
$file = $files[0];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
|
||||||
|
|
||||||
|
if ($stream) {
|
||||||
|
$stream.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $false;
|
||||||
|
} else {
|
||||||
|
return $true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||||
|
$browser.Navigate().GoToUrl($URL);
|
||||||
|
|
||||||
|
while (-not ($browser.ExecuteScript("return document.readyState;") -eq "complete")) {
|
||||||
|
Start-Sleep 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$null = & $downloadAction -Browser $browser;
|
||||||
|
|
||||||
|
while (& $downloadChecker) {
|
||||||
|
Write-Host "Waiting for the download to finish…";
|
||||||
|
Start-Sleep 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = Get-ChildItem $dir;
|
||||||
|
$result = Move-Item $file $OutDir -PassThru;
|
||||||
|
$browser.Quit();
|
||||||
|
Remove-Item -Recurse $dir;
|
||||||
|
$result;
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Error $Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Downloads a file from the specified url using browser automation.
|
||||||
|
|
||||||
|
.PARAMETER URL
|
||||||
|
The url to download the file from.
|
||||||
|
|
||||||
|
.PARAMETER ButtonSelector
|
||||||
|
The jQuery selector for finding the download button.
|
||||||
|
|
||||||
|
.PARAMETER OutDir
|
||||||
|
The directory to download the file to.
|
||||||
|
|
||||||
|
.PARAMETER Timeout
|
||||||
|
The number of seconds to wait before clicking the download button.
|
||||||
|
#>
|
||||||
|
function Start-BrowserDownload {
|
||||||
|
param(
|
||||||
|
[string] $URL,
|
||||||
|
[string] $ButtonSelector,
|
||||||
|
[string] $OutDir = $null,
|
||||||
|
[double] $Timeout = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
Start-CustomBrowserDownload @PSBoundParameters -Action {
|
||||||
|
param(
|
||||||
|
[OpenQA.Selenium.Firefox.FirefoxDriver] $Browser
|
||||||
|
)
|
||||||
|
|
||||||
|
$selector = [OpenQA.Selenium.By]::CssSelector($ButtonSelector);
|
||||||
|
[OpenQA.Selenium.IWebElement] $element = $null;
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt 5; $i++) {
|
||||||
|
$element = $Browser.FindElement($selector);
|
||||||
|
|
||||||
|
if ($element) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
Start-Sleep 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Timeout -gt 0) {
|
||||||
|
Start-Sleep $Timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($element) {
|
||||||
|
$Browser.FindElement($selector).Click();
|
||||||
|
} else {
|
||||||
|
Write-Error "Unable to find download button!";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
575
scripts/Common/Scripts/Config.ps1
Normal file
575
scripts/Common/Scripts/Config.ps1
Normal file
|
@ -0,0 +1,575 @@
|
||||||
|
using namespace Microsoft.Win32;
|
||||||
|
using namespace System.Management.Automation.Host;
|
||||||
|
using namespace System.Security.AccessControl;
|
||||||
|
using namespace System.Security.Principal;
|
||||||
|
|
||||||
|
enum WindowsInstallerStage {
|
||||||
|
Initialize
|
||||||
|
Run
|
||||||
|
Cleanup
|
||||||
|
Completed
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SetupStage {
|
||||||
|
Initialize
|
||||||
|
Configure
|
||||||
|
Install
|
||||||
|
CreateUser
|
||||||
|
}
|
||||||
|
|
||||||
|
enum BackupStage {
|
||||||
|
Initialize
|
||||||
|
Backup
|
||||||
|
BackupUsers
|
||||||
|
}
|
||||||
|
|
||||||
|
enum UserStage {
|
||||||
|
Create
|
||||||
|
Configure
|
||||||
|
Cleanup
|
||||||
|
Completed
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
[string] $configRoot = "HKLM:\Software\PortValhalla";
|
||||||
|
[string] $stageOption = "Stage";
|
||||||
|
[string] $setupStageOption = "SetupStage";
|
||||||
|
[string] $backupStageOption = "BackupStage";
|
||||||
|
[string] $userOption = "SetupUser";
|
||||||
|
[string] $userStageOption = "UserStage";
|
||||||
|
[string] $accountOption = "MSAccount";
|
||||||
|
[string] $finishedOption = "Finished";
|
||||||
|
[RegistryKey] $key = $null;
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Prompts the user to select a profile to act on.
|
||||||
|
#>
|
||||||
|
function Show-ProfileNamePrompt {
|
||||||
|
. "$PSScriptRoot/../../Windows/Types/WindowsInstallerAction.ps1";
|
||||||
|
|
||||||
|
$profiles = & {
|
||||||
|
. "$PSScriptRoot/SoftwareManagement.ps1";
|
||||||
|
|
||||||
|
if (Test-Command "wsl") {
|
||||||
|
return Invoke-ConfigScript "getProfiles";
|
||||||
|
} else {
|
||||||
|
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$choice = $Host.UI.PromptForChoice(
|
||||||
|
"Select Profile",
|
||||||
|
(& {
|
||||||
|
switch (Get-Stage) {
|
||||||
|
([WindowsInstallerAction]::Backup) {
|
||||||
|
"Which profile do you wish to back up?";
|
||||||
|
}
|
||||||
|
([WindowsInstallerAction]::Install) {
|
||||||
|
"Which profile do you wish to install?";
|
||||||
|
}
|
||||||
|
$null {
|
||||||
|
"Which profile do you wish to set up?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(& {
|
||||||
|
for ($i = 0; $i -lt $profiles.Count; $i++) {
|
||||||
|
[ChoiceDescription]"&$i - $($profiles[$i])";
|
||||||
|
}
|
||||||
|
|
||||||
|
[ChoiceDescription]"&Abort";
|
||||||
|
}),
|
||||||
|
$profiles.Count);
|
||||||
|
|
||||||
|
if ($choice -eq $profiles.Count) {
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$env:CONFIG_NAME = $profiles[$choice];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Converts the specified path to linux and escapes it for the use in a script.
|
||||||
|
|
||||||
|
.PARAMETER Path
|
||||||
|
The path to convert.
|
||||||
|
#>
|
||||||
|
function ConvertTo-LinuxPath {
|
||||||
|
param(
|
||||||
|
[string] $Path
|
||||||
|
)
|
||||||
|
|
||||||
|
& {
|
||||||
|
$ErrorActionPreference = 'Continue';
|
||||||
|
$completed = $false;
|
||||||
|
|
||||||
|
while (-not $completed) {
|
||||||
|
$job = Start-Job {
|
||||||
|
$env:Value = Resolve-Path $Using:Path;
|
||||||
|
$env:WSLENV = "Value/p";
|
||||||
|
$result = wsl -- bash -c 'echo "$Value"';
|
||||||
|
wsl -e printf "%q" "$result";
|
||||||
|
};
|
||||||
|
|
||||||
|
$result = Receive-Job -Wait $job;
|
||||||
|
|
||||||
|
|
||||||
|
if ((Split-Path -Leaf $Path) -ne (Split-Path -Leaf $result)) {
|
||||||
|
Write-Error "The result of the path conversion of ``$Path`` was unexpected: ``$result``";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($job.State -ne ([System.Management.Automation.JobState]::Completed)) {
|
||||||
|
Write-Error "An error occurred while converting ``$Path`` to a Linux path.`nOutput: ``$result``";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$completed = $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the registry key containing options related to the setup.
|
||||||
|
#>
|
||||||
|
function Get-SetupConfigKey {
|
||||||
|
if (-not (Test-Path $configRoot)) {
|
||||||
|
$key = New-Item $configRoot;
|
||||||
|
$acl = Get-Acl $configRoot;
|
||||||
|
|
||||||
|
$acl.AddAccessRule(
|
||||||
|
[RegistryAccessRule]::new(
|
||||||
|
[SecurityIdentifier]::new([WellKnownSidType]::BuiltinUsersSid, $null),
|
||||||
|
[RegistryRights]::FullControl,
|
||||||
|
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit,
|
||||||
|
[PropagationFlags]::None,
|
||||||
|
[AccessControlType]::Allow));
|
||||||
|
|
||||||
|
Set-Acl $configRoot $acl;
|
||||||
|
} else {
|
||||||
|
$key = Get-Item $configRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Runs a script based on the `config.fish` script.
|
||||||
|
|
||||||
|
.PARAMETER Script
|
||||||
|
The script to run.
|
||||||
|
#>
|
||||||
|
function Invoke-ConfigScript {
|
||||||
|
param(
|
||||||
|
[string] $Script
|
||||||
|
)
|
||||||
|
|
||||||
|
$scriptPath = "$PSScriptRoot/../../Common/Scripts/config.fish";
|
||||||
|
|
||||||
|
if ($env:CONFIG_NAME -or ($Script -eq "getProfiles")) {
|
||||||
|
$output = & {
|
||||||
|
if (-not $IsWindows) {
|
||||||
|
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
||||||
|
fish -c ". $escapedPath; $Script";
|
||||||
|
} else {
|
||||||
|
$cleanup = { };
|
||||||
|
$projectRoot = "$PSScriptRoot/../../..";
|
||||||
|
$archisoDir = "$projectRoot/archiso";
|
||||||
|
|
||||||
|
function fish {
|
||||||
|
wsl --shell-type login -- nix --extra-experimental-features "nix-command flakes" run nixpkgs`#fish -- $args
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path -PathType Container "$archisoDir") {
|
||||||
|
$git = {
|
||||||
|
git -C "$projectRoot" -c safe.directory="$("$(Resolve-Path $projectRoot)".Replace("\", "/"))" @args;
|
||||||
|
};
|
||||||
|
|
||||||
|
& $git rm -r --cached "$archisoDir" *> $null;
|
||||||
|
$cleanup = { & $git restore --staged "$archisoDir" };
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = fish -c ". $(ConvertTo-LinuxPath $scriptPath); $Script";
|
||||||
|
|
||||||
|
if (-not $?) {
|
||||||
|
Write-Error "The configuration could not be retrieved!";
|
||||||
|
} else {
|
||||||
|
$output;
|
||||||
|
}
|
||||||
|
|
||||||
|
& $cleanup *> $null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not ($output -and ($output | Test-Json))) {
|
||||||
|
Write-Error "The value ``$output`` is not valid JSON.";
|
||||||
|
} else {
|
||||||
|
$output | ConvertFrom-Json;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets a configuration option.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the option to get.
|
||||||
|
#>
|
||||||
|
function Get-Config {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments)]
|
||||||
|
[string[]] $ArgumentList
|
||||||
|
)
|
||||||
|
|
||||||
|
Invoke-ConfigScript "getConfig $Name --json $ArgumentList";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the config root.
|
||||||
|
#>
|
||||||
|
function Get-ConfigRootName {
|
||||||
|
return "valhalla.$($IsWindows ? "windows" : "linux")";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the user root.
|
||||||
|
#>
|
||||||
|
function Get-UserRootName {
|
||||||
|
return "$(Get-ConfigRootName).$($IsWindows ? "winUsers" : "users")";
|
||||||
|
};
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets a user configuration.
|
||||||
|
|
||||||
|
.PARAMETER UserName
|
||||||
|
The name of the user to get the configuration for.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the configuration to get.
|
||||||
|
#>
|
||||||
|
function Get-UserConfig {
|
||||||
|
param(
|
||||||
|
[string] $UserName = ($IsWindows ? $env:UserName : $env:USER),
|
||||||
|
[Parameter(Mandatory, Position = 0)]
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
if ((Get-Users) -contains $UserName) {
|
||||||
|
Get-Config "$(Get-UserRootName).$UserName.$Name";
|
||||||
|
} else {
|
||||||
|
return $null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the attributes of a configuration object.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the configuration to get the attributes of.
|
||||||
|
#>
|
||||||
|
function Get-Attributes {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
Invoke-ConfigScript "getAttributes $Name";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the names of the users to create.
|
||||||
|
#>
|
||||||
|
function Get-Users {
|
||||||
|
[OutputType([string[]])]
|
||||||
|
param()
|
||||||
|
Get-Attributes "$(Get-UserRootName)";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the setup user.
|
||||||
|
#>
|
||||||
|
function Get-SetupUser {
|
||||||
|
[OutputType([string])]
|
||||||
|
param()
|
||||||
|
Get-Config "$(Get-ConfigRootName).setupUser.name";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the value of an option related to the setup.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the option value to get.
|
||||||
|
#>
|
||||||
|
function Get-SetupOption {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
$key = Get-SetupConfigKey;
|
||||||
|
|
||||||
|
if ($key.GetValueNames().Contains($Name)) {
|
||||||
|
return $key.GetValue($Name);
|
||||||
|
} else {
|
||||||
|
return $null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the value of an option related to the setup.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the option to set.
|
||||||
|
|
||||||
|
.PARAMETER Value
|
||||||
|
The value to set the option to.
|
||||||
|
#>
|
||||||
|
function Set-SetupOption {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
$Value
|
||||||
|
)
|
||||||
|
|
||||||
|
$key = Get-SetupConfigKey;
|
||||||
|
$null = Set-ItemProperty ($key.PSPath) -Name $Name -Value $Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the current stage of the Windows install script action.
|
||||||
|
#>
|
||||||
|
function Get-Stage {
|
||||||
|
$stage = Get-SetupOption $stageOption;
|
||||||
|
|
||||||
|
if ($null -ne $stage) {
|
||||||
|
$stage = [WindowsInstallerStage]$stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the name of the current stage of the Windows install script action.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the stage to set.
|
||||||
|
#>
|
||||||
|
function Set-Stage {
|
||||||
|
param(
|
||||||
|
$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||||
|
$Name = ([WindowsInstallerStage]$Name).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = Set-SetupOption $stageOption $Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the current setup stage.
|
||||||
|
#>
|
||||||
|
function Get-SetupStage {
|
||||||
|
$stage = Get-SetupOption $setupStageOption;
|
||||||
|
|
||||||
|
if ($null -ne $stage) {
|
||||||
|
$stage = [SetupStage]$stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the current stage.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name to set the current stage to.
|
||||||
|
#>
|
||||||
|
function Set-SetupStage {
|
||||||
|
param(
|
||||||
|
$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||||
|
$Name = ([SetupStage]$Name).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = Set-SetupOption $setupStageOption $Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the current stage of the backup.
|
||||||
|
#>
|
||||||
|
function Get-BackupStage {
|
||||||
|
$stage = Get-SetupOption $backupStageOption;
|
||||||
|
|
||||||
|
if ($null -ne $stage) {
|
||||||
|
$stage = [BackupStage]$stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the current stage of the backup.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name to set the current stage to.
|
||||||
|
#>
|
||||||
|
function Set-BackupStage {
|
||||||
|
param(
|
||||||
|
$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||||
|
$Name = ([BackupStage]$Name).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = Set-SetupOption $backupStageOption $Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the current user to set up.
|
||||||
|
#>
|
||||||
|
function Get-CurrentUser {
|
||||||
|
return (Get-SetupOption $userOption) ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the index of the current user to set up.
|
||||||
|
|
||||||
|
.PARAMETER Value
|
||||||
|
The index of the user to set up.
|
||||||
|
#>
|
||||||
|
function Set-CurrentUser {
|
||||||
|
param(
|
||||||
|
[int] $Value
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-SetupOption $userOption $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the current stage of the user setup.
|
||||||
|
#>
|
||||||
|
function Get-UserStage {
|
||||||
|
$stage = Get-SetupOption $userStageOption;
|
||||||
|
|
||||||
|
if ($null -ne $stage) {
|
||||||
|
$stage = [UserStage]$stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the current stage of the user setup.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the stage to set.
|
||||||
|
#>
|
||||||
|
function Set-UserStage {
|
||||||
|
param(
|
||||||
|
$Name
|
||||||
|
)
|
||||||
|
|
||||||
|
if (-not (($null -eq $Name) -or ($Name -is [string]))) {
|
||||||
|
$Name = ([UserStage]$Name).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$null = Set-SetupOption $userStageOption $Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the name of the microsoft account to create.
|
||||||
|
#>
|
||||||
|
function Get-MSAccountName {
|
||||||
|
return Get-SetupOption $accountOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets the name of the microsoft account to create.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the microsoft account to create.
|
||||||
|
#>
|
||||||
|
function Set-MSAccountName {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-SetupOption $accountOption $Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets a value indicating whether the setup has finished.
|
||||||
|
#>
|
||||||
|
function Get-IsFinished {
|
||||||
|
return [bool](Get-SetupOption $finishedOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets a value indicating whether the setup has finished.
|
||||||
|
#>
|
||||||
|
function Set-IsFinished {
|
||||||
|
param(
|
||||||
|
$Value
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-SetupOption $finishedOption $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether the running system is a QEMU virtual machine.
|
||||||
|
#>
|
||||||
|
function Test-Qemu {
|
||||||
|
((Get-WmiObject win32_computersystem).Manufacturer) -eq "QEMU";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether the current user is the setup user.
|
||||||
|
#>
|
||||||
|
function Test-SetupUser {
|
||||||
|
($IsWindows ? $env:UserName : $env:USER) -eq (Get-SetupUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether the active session is executed with admin rights.
|
||||||
|
#>
|
||||||
|
function Test-Admin {
|
||||||
|
net session 2> $null | Out-Null;
|
||||||
|
return $?;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/pwsh
|
#!/bin/pwsh
|
||||||
. "$PSScriptRoot/Entrypoints.ps1";
|
. "$PSScriptRoot/../../Common/Scripts/Entrypoints.ps1";
|
||||||
. "$PSScriptRoot/../../Common/Software/powershell/profile.ps1";
|
. "$PSScriptRoot/../../Common/Software/PowerShell/Profile.ps1";
|
||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
[string]$EntryPoint;
|
[string]$EntryPoint;
|
||||||
|
@ -68,9 +68,9 @@ class Context {
|
||||||
|
|
||||||
[void] AddPowerShellProfileStatement([bool] $system, [string] $category, [string] $statement, [bool] $overwrite) {
|
[void] AddPowerShellProfileStatement([bool] $system, [string] $category, [string] $statement, [bool] $overwrite) {
|
||||||
if ($system) {
|
if ($system) {
|
||||||
Add-PowerShellProfileStatement -System -Category $category -Statement $statement -Overwrite $overwrite;
|
Add-PowerShellProfileStatement -System -Category $category -Script $statement -Overwrite:$overwrite;
|
||||||
} else {
|
} else {
|
||||||
Add-PowerShellProfileStatement -Category $category -Statement $statement -Overwrite $overwrite;
|
Add-PowerShellProfileStatement -Category $category -Script $statement -Overwrite:$overwrite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
429
scripts/Common/Scripts/Operations.ps1
Normal file
429
scripts/Common/Scripts/Operations.ps1
Normal file
|
@ -0,0 +1,429 @@
|
||||||
|
using namespace System.Management.Automation.Host;
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../Types/OneShotTask.ps1";
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/Config.ps1";
|
||||||
|
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
|
||||||
|
. "$PSScriptRoot/../Types/OneShotTask.ps1";
|
||||||
|
. "$PSScriptRoot/../../Windows/Scripts/Hooks.ps1";
|
||||||
|
. "$PSScriptRoot/../../Windows/Scripts/PowerManagement.ps1";
|
||||||
|
. "$PSScriptRoot/../../Windows/Scripts/Registry.ps1";
|
||||||
|
. "$PSScriptRoot/../../Windows/Scripts/Security.ps1";
|
||||||
|
. "$PSScriptRoot/../../Windows/Scripts/WSL.ps1";
|
||||||
|
$oneShotTaskName = "PortValhalla OneShot";
|
||||||
|
$logName = "Application";
|
||||||
|
$oneShotTrigger = 1337;
|
||||||
|
$taskOption = "OneShotTask";
|
||||||
|
# ToDo: Store "ProgramData/PortValhalla" path somewhere as const
|
||||||
|
$errorPath = "$env:ProgramData/PortValhalla/error.txt";
|
||||||
|
|
||||||
|
$getUserName = {
|
||||||
|
"$(Get-SetupUser)OneShot";
|
||||||
|
};
|
||||||
|
|
||||||
|
$taskSetter = {
|
||||||
|
param([Nullable[OneShotTask]] $Task)
|
||||||
|
Set-SetupOption $taskOption ([string]$Task);
|
||||||
|
};
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the PowerShell modules required for operating.
|
||||||
|
#>
|
||||||
|
function Get-RequiredModules {
|
||||||
|
$modules = @(
|
||||||
|
@("PSScriptAnalyzer")
|
||||||
|
) + (& {
|
||||||
|
if (-not $IsWindows) {
|
||||||
|
@()
|
||||||
|
} else {
|
||||||
|
@(
|
||||||
|
@("KnownFolders"),
|
||||||
|
@("PSWindowsUpdate"),
|
||||||
|
@("LocalAccounts", $true),
|
||||||
|
@("NuGet")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $modules.Count; $i++) {
|
||||||
|
if ($modules[$i] -is [string]) {
|
||||||
|
$modules[$i] = @($modules[$i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Start-Operation {
|
||||||
|
param(
|
||||||
|
[switch] $NonInteractive,
|
||||||
|
[switch] $NoImplicitCleanup,
|
||||||
|
[scriptblock] $Action
|
||||||
|
)
|
||||||
|
|
||||||
|
$cleanup = { };
|
||||||
|
$taskPending = $false;
|
||||||
|
|
||||||
|
if (-not $Global:InOperation) {
|
||||||
|
if ($env:DEBUG) {
|
||||||
|
Set-PSDebug -Trace 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($IsWindows -and ($null -ne (Get-OneShotTask))) {
|
||||||
|
$taskPending = $true;
|
||||||
|
[switch] $NonInteractive = $true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Global:InOperation = $true;
|
||||||
|
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
|
||||||
|
|
||||||
|
if ($IsWindows) {
|
||||||
|
$env:WSLENV = "CONFIG_NAME";
|
||||||
|
New-Alias -Force "sudo" gsudo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $NoImplicitCleanup.IsPresent) {
|
||||||
|
$cleanup = {
|
||||||
|
Clear-OperationResources;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
& {
|
||||||
|
$initialized = $false;
|
||||||
|
|
||||||
|
while (-not $initialized) {
|
||||||
|
if ($IsWindows) {
|
||||||
|
if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) {
|
||||||
|
Invoke-Hook "Install-Chocolatey" -Fallback {
|
||||||
|
# Install chocolatey
|
||||||
|
New-Item -Force $PROFILE;
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||||
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'));
|
||||||
|
Import-Module $env:ChocolateyInstall/helpers/chocolateyProfile.psm1;
|
||||||
|
refreshenv;
|
||||||
|
};
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-ChocoPackage "powershell-core")) {
|
||||||
|
Invoke-Hook "Install-PowerShellCore" -Fallback {
|
||||||
|
choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"';
|
||||||
|
};
|
||||||
|
|
||||||
|
Restart-Intermediate;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($env:PWSH_PATH -and (Test-Path $env:PWSH_PATH)) {
|
||||||
|
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||||
|
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($env:DEBUG) {
|
||||||
|
$liveScriptOption = "LiveScripts";
|
||||||
|
|
||||||
|
if (($null -eq (Get-SetupOption $liveScriptOption)) -and (Test-Qemu)) {
|
||||||
|
$result = $Host.UI.PromptForChoice(
|
||||||
|
"Confirm",
|
||||||
|
"Do you wish to swap to live scripts?",
|
||||||
|
[ChoiceDescription[]]@(
|
||||||
|
[ChoiceDescription]::new("&No", "Use scripts stored in the virtual machine"),
|
||||||
|
[ChoiceDescription]::new("&Yes", "Use live scripts stored on the host")),
|
||||||
|
0);
|
||||||
|
|
||||||
|
Set-SetupOption $liveScriptOption $result;
|
||||||
|
|
||||||
|
if ($result -eq 1) {
|
||||||
|
Install-ChocoPackage winfsp qemu-guest-agent;
|
||||||
|
Get-Service VirtioFsSvc | Start-Service -PassThru | Set-Service -StartupType Automatic;
|
||||||
|
|
||||||
|
while (-not (Test-Path Z:\)) {
|
||||||
|
Start-Sleep 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($name in @("INSTALLER_SCRIPT")) {
|
||||||
|
$variable = Get-Item "Env:\$name";
|
||||||
|
|
||||||
|
$path = Join-Path `
|
||||||
|
"Z:\Repositories\PortValhalla" `
|
||||||
|
([System.IO.Path]::GetRelativePath("$PSScriptRoot/../../..", $variable.Value));
|
||||||
|
|
||||||
|
Set-Item "Env:\$name" $path;
|
||||||
|
Write-Host "The new value of ``$name`` is ``$path``";
|
||||||
|
}
|
||||||
|
|
||||||
|
Restart-Intermediate;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Command "gsudo")) {
|
||||||
|
Install-ChocoPackage gsudo;
|
||||||
|
refreshenv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($env:DEBUG) {
|
||||||
|
& {
|
||||||
|
$sys32 = "$env:WINDIR/System32";
|
||||||
|
$osk = (Get-Item "$sys32/osk.exe").FullName;
|
||||||
|
$cmd = (Get-Item "$sys32/cmd.exe").FullName;
|
||||||
|
|
||||||
|
if ((Get-FileHash $osk).Hash -ne (Get-FileHash $cmd).Hash) {
|
||||||
|
Set-MpPreference -ExclusionPath $osk;
|
||||||
|
gsudo -d --ti move $osk "${osk}_";
|
||||||
|
gsudo -d -s copy $cmd $osk;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Winget)) {
|
||||||
|
. "$PSScriptRoot/../../Windows/Software/winget/Manage.ps1";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Command "git")) {
|
||||||
|
Install-WingetPackage Git.Git;
|
||||||
|
refreshenv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Command "7z")) {
|
||||||
|
Install-ChocoPackage 7zip.portable;
|
||||||
|
refreshenv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Command "yq")) {
|
||||||
|
Install-ChocoPackage "yq";
|
||||||
|
refreshenv;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Wsl)) {
|
||||||
|
Install-Wsl;
|
||||||
|
Restart-Intermediate;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-WslDistribution)) {
|
||||||
|
if (-not (Test-Path (Get-WslDistributionDisk))) {
|
||||||
|
Install-WslDistribution;
|
||||||
|
}
|
||||||
|
|
||||||
|
Register-WslDistribution;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (wsl --shell-type login type -t nix)) {
|
||||||
|
wsl -- sh `<`(curl -L https://nixos.org/nix/install`) --daemon --yes;
|
||||||
|
wsl --shutdown;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
||||||
|
Write-Host "Installing browser automation tools…";
|
||||||
|
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.24.0 -SkipDependencies;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Install-ChocoPackage selenium-gecko-driver firefox;
|
||||||
|
Install-WingetPackage AutoHotkey.AutoHotkey;
|
||||||
|
. "$PSScriptRoot/../../Windows/Software/PinnedItem/Manage.ps1";
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-Hook "Install-PSModules" -Fallback {
|
||||||
|
foreach ($module in (Get-RequiredModules)) {
|
||||||
|
$parameters = @{ };
|
||||||
|
|
||||||
|
if ($module -is [string]) {
|
||||||
|
$module = @($module);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($module[1]) {
|
||||||
|
$parameters = @{
|
||||||
|
allowPrerelease = $true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-PSModule $module[0])) {
|
||||||
|
Install-Module -Scope AllUsers -AcceptLicense -Force -AllowClobber $module[0] @parameters;
|
||||||
|
Import-Module $module[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (-not $env:CONFIG_NAME) {
|
||||||
|
Show-ProfileNamePrompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
$initialized = $true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($taskPending) {
|
||||||
|
Start-OneShot;
|
||||||
|
} else {
|
||||||
|
& $Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
& $cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the current OneShot task.
|
||||||
|
#>
|
||||||
|
function Get-OneShotTask {
|
||||||
|
$task = Get-SetupOption $taskOption;
|
||||||
|
|
||||||
|
if ($task) {
|
||||||
|
return [OneShotTask]$task;
|
||||||
|
} else {
|
||||||
|
return $null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Registers a task for listening to OneShot invocations.
|
||||||
|
#>
|
||||||
|
function Enable-OneShotListener {
|
||||||
|
$tempTask = "PortValhalla Temp";
|
||||||
|
$user = & $getUserName;
|
||||||
|
$password = [string]([guid]::NewGuid());
|
||||||
|
|
||||||
|
$adminGroup = @{
|
||||||
|
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||||
|
};
|
||||||
|
|
||||||
|
$null = New-LocalUser -Name $user -Password (ConvertTo-SecureString -AsPlainText $password);
|
||||||
|
Add-LocalGroupMember -Member $user @adminGroup;
|
||||||
|
$path = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList";
|
||||||
|
$null = New-Item -Force -ErrorAction SilentlyContinue $path;
|
||||||
|
Set-ItemProperty $path -Name $user -Value 0;
|
||||||
|
|
||||||
|
$action = New-ScheduledTaskAction -Execute "pwsh" -Argument "-Command & { $([string](Get-StartupCommand)) } 2>&1 | Tee-Object -FilePath `$env:ProgramData/PortValhalla/OneShotTask.log";
|
||||||
|
schtasks /Create /SC ONEVENT /EC $logName /MO "*[System[Provider[@Name='$logName'] and EventID=$($oneShotTrigger)]]" /TR cmd.exe /TN $tempTask;
|
||||||
|
$trigger = (Get-ScheduledTask $tempTask).Triggers;
|
||||||
|
$null = Register-ScheduledTask -Force $oneShotTaskName -Action $action -Trigger $trigger -RunLevel Highest -User $user -Password $password;
|
||||||
|
$null = Unregister-ScheduledTask -Confirm:$false $tempTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Removes the OneShot task.
|
||||||
|
#>
|
||||||
|
function Disable-OneShotListener {
|
||||||
|
Unregister-ScheduledTask -Confirm:$false $oneShotTaskName;
|
||||||
|
$user = Get-LocalUser (& $getUserName);
|
||||||
|
[string] $sid = $user.SID;
|
||||||
|
Remove-LocalUser $user;
|
||||||
|
Get-CimInstance Win32_UserProfile | Where-Object { $_.SID -eq $sid } | Remove-CimInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Invokes a one-shot task.
|
||||||
|
|
||||||
|
.PARAMETER Task
|
||||||
|
The task to run.
|
||||||
|
#>
|
||||||
|
function Invoke-OneShot {
|
||||||
|
param(
|
||||||
|
[OneShotTask] $Task
|
||||||
|
)
|
||||||
|
|
||||||
|
& $taskSetter $Task;
|
||||||
|
|
||||||
|
& {
|
||||||
|
$identifier = "EventLog$oneShotTrigger";
|
||||||
|
$log = [System.Diagnostics.EventLog]::new($logName);
|
||||||
|
$log.EnableRaisingEvents = $true;
|
||||||
|
|
||||||
|
$null = Register-ObjectEvent -InputObject $log -EventName EntryWritten -Action {
|
||||||
|
$entry = $Event.SourceEventArgs.Entry;
|
||||||
|
$trigger = $Event.MessageData.Trigger;
|
||||||
|
$identifier = $Event.MessageData.Identifier;
|
||||||
|
|
||||||
|
if ($entry.EventID -eq $trigger) {
|
||||||
|
$null = New-Event -SourceIdentifier $identifier;
|
||||||
|
}
|
||||||
|
} `
|
||||||
|
-MessageData @{
|
||||||
|
Trigger = $oneShotTrigger;
|
||||||
|
Identifier = $identifier;
|
||||||
|
};
|
||||||
|
|
||||||
|
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "Starting OneShot task ``$(Get-OneShotTask)``…";
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt 2; $i++) {
|
||||||
|
Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Test-Path $errorPath) {
|
||||||
|
$errorMessage = Get-Content $errorPath;
|
||||||
|
Remove-Item $errorPath;
|
||||||
|
|
||||||
|
if ($errorMessage) {
|
||||||
|
Write-Error $errorMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ToDo: Store Run-OneShot and Receive-OneShot somewhere else in Windows folder
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Executes the specified action and notifies the OneShot task executor.
|
||||||
|
#>
|
||||||
|
function Start-OneShot {
|
||||||
|
try {
|
||||||
|
Write-Host "Running OneShot task ``$(Get-OneShotTask)``";
|
||||||
|
|
||||||
|
switch (Get-OneShotTask) {
|
||||||
|
([OneShotTask]::InitializeMSAccount) {
|
||||||
|
Initialize-UserCreation;
|
||||||
|
}
|
||||||
|
([OneShotTask]::DisableUAC) {
|
||||||
|
Disable-UAC;
|
||||||
|
Register-Setup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Set-Content -Path $errorPath -Value $Error;
|
||||||
|
Set-UserPermissions $errorPath;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
& $taskSetter $null;
|
||||||
|
Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "The OneShot task ``$(Get-OneShotTask)`` finished.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Clears resources allocated during the operation.
|
||||||
|
#>
|
||||||
|
function Clear-OperationResources {
|
||||||
|
if ($IsWindows) {
|
||||||
|
Uninstall-WslDistribution;
|
||||||
|
$null = Uninstall-Package Selenium.WebDriver -ErrorAction Continue;
|
||||||
|
Uninstall-ChocoPackage 7zip.portable gsudo selenium-gecko-driver yq;
|
||||||
|
Uninstall-WingetPackage AutoHotkey.AutoHotkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($module in (Get-RequiredModules)) {
|
||||||
|
Remove-Module -Force $module[0];
|
||||||
|
Uninstall-Module -Force -Name $module[0] -ErrorAction SilentlyContinue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
71
scripts/Common/Scripts/Scripting.ps1
Normal file
71
scripts/Common/Scripts/Scripting.ps1
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Converts the specified value into a form to safle inject it into a script.
|
||||||
|
|
||||||
|
.PARAMETER value
|
||||||
|
The value to convert for injection.
|
||||||
|
#>
|
||||||
|
function ConvertTo-Injection {
|
||||||
|
param(
|
||||||
|
$Value
|
||||||
|
)
|
||||||
|
|
||||||
|
"([System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String('$(
|
||||||
|
[System.Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes($value))
|
||||||
|
)')))"
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Writes a PowerShell script to a specified location.
|
||||||
|
|
||||||
|
.PARAMETER FileName
|
||||||
|
The name of the file to write the script to.
|
||||||
|
|
||||||
|
.PARAMETER Script
|
||||||
|
The script to write to the file.
|
||||||
|
|
||||||
|
.PARAMETER Replace
|
||||||
|
A value indicating whether the file should be overwritten if it exists.
|
||||||
|
|
||||||
|
.PARAMETER Append
|
||||||
|
A value indicating whether the content should be appended if the file already exists.
|
||||||
|
#>
|
||||||
|
function Write-PSScript {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[Parameter(ParameterSetName="Common")]
|
||||||
|
[Parameter(ParameterSetName="Replace")]
|
||||||
|
[Parameter(ParameterSetName="Append")]
|
||||||
|
[string] $FileName,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[Parameter(ParameterSetName="Common")]
|
||||||
|
[Parameter(ParameterSetName="Replace")]
|
||||||
|
[Parameter(ParameterSetName="Append")]
|
||||||
|
[string] $Script,
|
||||||
|
[Parameter(ParameterSetName="Replace", Mandatory=$true)]
|
||||||
|
[switch] $Replace,
|
||||||
|
[Parameter(ParameterSetName="Append", Mandatory=$true)]
|
||||||
|
[switch] $Append
|
||||||
|
)
|
||||||
|
|
||||||
|
Import-Module PSScriptAnalyzer;
|
||||||
|
$dirName = Split-Path -Parent $FileName;
|
||||||
|
$Script = ($Script -split "\r?\n") -join [System.Environment]::NewLine;
|
||||||
|
$content = Invoke-Formatter -ScriptDefinition $Script;
|
||||||
|
$exists = Test-Path -PathType Leaf $FileName;
|
||||||
|
|
||||||
|
if (-not (Test-Path -PathType Container $dirName)) {
|
||||||
|
$null = New-Item -ItemType Directory $dirName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($exists -and ($Append.IsPresent)) {
|
||||||
|
Add-Content -Force $FileName "`n$content";
|
||||||
|
} else {
|
||||||
|
if ((-not $exists) -or $Replace.IsPresent) {
|
||||||
|
Set-Content -Force $FileName $content;
|
||||||
|
} else {
|
||||||
|
Write-Host "The file ``$FileName`` already exists!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
392
scripts/Common/Scripts/Software.ps1
Normal file
392
scripts/Common/Scripts/Software.ps1
Normal file
|
@ -0,0 +1,392 @@
|
||||||
|
. "$PSScriptRoot/Config.ps1";
|
||||||
|
. "$PSScriptRoot/Operations.ps1";
|
||||||
|
. "$PSScriptRoot/System.ps1";
|
||||||
|
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/BrowserAutomation.ps1";
|
||||||
|
. "$PSScriptRoot/SoftwareManagement.ps1";
|
||||||
|
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||||
|
$userArgument = "name";
|
||||||
|
|
||||||
|
$chocoRunner = {
|
||||||
|
param(
|
||||||
|
[string] $Action = 'install',
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[scriptblock] $Guard = { $true },
|
||||||
|
[Parameter(Position = 0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
[System.Collections.ArrayList] $Names = @();
|
||||||
|
$null = $Names.Add($Name);
|
||||||
|
$Names.AddRange($AdditionalNames);
|
||||||
|
|
||||||
|
if (-not ($Force.IsPresent)) {
|
||||||
|
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
|
||||||
|
$name = $Names[$i];
|
||||||
|
|
||||||
|
if (-not (& $Guard $name)) {
|
||||||
|
$Names.RemoveAt($i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Names.Count -ge 1) {
|
||||||
|
choco $Action -y @ArgumentList @Names;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$wingetRunner = {
|
||||||
|
param(
|
||||||
|
[string] $Action = 'install',
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[scriptblock] $Guard = { $true },
|
||||||
|
[Parameter(Position = 0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
[System.Collections.ArrayList] $Names = @();
|
||||||
|
$null = $Names.Add($Name);
|
||||||
|
$Names.AddRange($AdditionalNames);
|
||||||
|
|
||||||
|
[string[]] $arguments = $ArgumentList + (& {
|
||||||
|
if ($Action -eq 'install') {
|
||||||
|
@("--accept-package-agreements")
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach ($name in $Names) {
|
||||||
|
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
|
||||||
|
winget $Action `
|
||||||
|
--accept-source-agreements `
|
||||||
|
--source winget `
|
||||||
|
@arguments `
|
||||||
|
--exact --id $name ;
|
||||||
|
} else {
|
||||||
|
Write-Host "Package ``$name`` is already installed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs the specified packages using chocolatey.
|
||||||
|
|
||||||
|
.PARAMETER Names
|
||||||
|
The names of the packages to install.
|
||||||
|
#>
|
||||||
|
function Install-ChocoPackage {
|
||||||
|
param(
|
||||||
|
[switch] $Force,
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[Parameter(Position=0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
& $chocoRunner @PSBoundParameters -Guard {
|
||||||
|
param($Name)
|
||||||
|
if (Test-ChocoPackage $Name) {
|
||||||
|
Write-Host "Package ``$Name`` is already installed"
|
||||||
|
$false;
|
||||||
|
} else {
|
||||||
|
$true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Uninstalls the specified packages using chocolatey.
|
||||||
|
#>
|
||||||
|
function Uninstall-ChocoPackage {
|
||||||
|
param(
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[Parameter(Position=0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
& $chocoRunner @PSBoundParameters -Action 'uninstall' -Guard {
|
||||||
|
param($Name)
|
||||||
|
if (Test-ChocoPackage $Name) {
|
||||||
|
$true;
|
||||||
|
} else {
|
||||||
|
Write-Host "Package ``$Name`` is not installed";
|
||||||
|
$false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs the specified packages using `winget`.
|
||||||
|
|
||||||
|
.PARAMETER Names
|
||||||
|
The names of the packages to install.
|
||||||
|
#>
|
||||||
|
function Install-WingetPackage {
|
||||||
|
param(
|
||||||
|
[switch] $Force,
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[Parameter(Position=0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
& $wingetRunner @PSBoundParameters `
|
||||||
|
-Guard {
|
||||||
|
param($Name, $Parameters)
|
||||||
|
if (Test-WingetPackage @Parameters) {
|
||||||
|
Write-Host "Package ``$Name`` is already installed"
|
||||||
|
$false;
|
||||||
|
} else {
|
||||||
|
$true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Uninstalls the specified packages using `winget`.
|
||||||
|
#>
|
||||||
|
function Uninstall-WingetPackage {
|
||||||
|
param(
|
||||||
|
[string[]] $ArgumentList,
|
||||||
|
[Parameter(Position=0)]
|
||||||
|
[string] $Name,
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $AdditionalNames = @()
|
||||||
|
)
|
||||||
|
|
||||||
|
& $wingetRunner @PSBoundParameters -Action 'uninstall' -Guard {
|
||||||
|
param($Name, $Parameters)
|
||||||
|
if (Test-WingetPackage @Parameters) {
|
||||||
|
$true;
|
||||||
|
} else {
|
||||||
|
Write-Host "Package ``$Name`` is not installed"
|
||||||
|
$false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs a setup package from the specified source.
|
||||||
|
|
||||||
|
.PARAMETER Source
|
||||||
|
The location of the setup package.
|
||||||
|
|
||||||
|
.PARAMETER ArgumentList
|
||||||
|
The arguments to pass to the setup package.
|
||||||
|
|
||||||
|
.PARAMETER Local
|
||||||
|
A value indicating whether the setup package is stored locally.
|
||||||
|
#>
|
||||||
|
function Install-SetupPackage {
|
||||||
|
param(
|
||||||
|
[string] $Source,
|
||||||
|
[string[]] $ArgumentList = @("/S"),
|
||||||
|
[switch] $Local
|
||||||
|
)
|
||||||
|
|
||||||
|
[string] $dir = $null;
|
||||||
|
[string] $filePath = $null;
|
||||||
|
|
||||||
|
if (-not ($Local.IsPresent)) {
|
||||||
|
$dir = New-TemporaryDirectory;
|
||||||
|
Write-Host "Determining the file name of ``$Source``…";
|
||||||
|
$fileName = ([uri]$Source).Segments[-1];
|
||||||
|
Write-Host "Found name ``$fileName``";
|
||||||
|
$filePath = Join-Path $dir $fileName;
|
||||||
|
|
||||||
|
Write-Host "Downloading setup file from ``$Source``";
|
||||||
|
Invoke-WebRequest $Source -OutFile $filePath;
|
||||||
|
} else {
|
||||||
|
$filePath = $Source;
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Starting installation of ``$(Split-Path -Leaf $filePath)``";
|
||||||
|
Start-Process -Wait -WorkingDirectory (Split-Path -Parent $filePath) -FilePath $filePath -ArgumentList $ArgumentList;
|
||||||
|
|
||||||
|
if ($dir) {
|
||||||
|
Remove-Item -Recurse $dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Installs a package downloaded from ASUS.
|
||||||
|
|
||||||
|
.PARAMETER URL
|
||||||
|
The URL to download the package from.
|
||||||
|
#>
|
||||||
|
function Install-AsusPackage {
|
||||||
|
param(
|
||||||
|
[string] $URL
|
||||||
|
)
|
||||||
|
|
||||||
|
$file = "AsusPackage.zip";
|
||||||
|
$dir = New-TemporaryDirectory;
|
||||||
|
$unpackDir = New-TemporaryDirectory;
|
||||||
|
|
||||||
|
$null = Push-Location $dir;
|
||||||
|
Invoke-WebRequest $URL -OutFile $file;
|
||||||
|
Expand-Archive $file $unpackDir;
|
||||||
|
$null = Pop-Location;
|
||||||
|
Remove-Item -Recurse $dir;
|
||||||
|
|
||||||
|
$null = Start-Process -Wait -WorkingDirectory $unpackDir -FilePath (Join-Path $unpackDir "AsusSetup.exe") -ArgumentList "/S";
|
||||||
|
Remove-Item -Recurse $unpackDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Downloads and installs a package from the AMD website.
|
||||||
|
|
||||||
|
.PARAMETER URL
|
||||||
|
The URL to download the package from.
|
||||||
|
#>
|
||||||
|
function Install-AmdPackage {
|
||||||
|
param(
|
||||||
|
[string] $URL
|
||||||
|
)
|
||||||
|
|
||||||
|
$dir = New-TemporaryDirectory;
|
||||||
|
$cookieBannerSelector = "#onetrust-consent-sdk";
|
||||||
|
$osSelector = "div[id$='oscategory']>div[id$='-0']";
|
||||||
|
$downloadSelector = "$osSelector div[id$='panel'] .button a";
|
||||||
|
|
||||||
|
$file = Start-CustomBrowserDownload @PSBoundParameters -OutDir $dir -Action {
|
||||||
|
param(
|
||||||
|
[OpenQA.Selenium.Firefox.FirefoxDriver] $Browser
|
||||||
|
)
|
||||||
|
|
||||||
|
$osContainer = $Browser.FindElement([OpenQA.Selenium.By]::CssSelector($osSelector));
|
||||||
|
|
||||||
|
if (-not ([bool] $osContainer.GetAttribute("cmp-expanded"))) {
|
||||||
|
$osContainer.Click();
|
||||||
|
}
|
||||||
|
|
||||||
|
$download = {
|
||||||
|
$browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click();
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
& $download;
|
||||||
|
} catch {
|
||||||
|
$null = $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
||||||
|
& $download;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Start-Process -Wait -WorkingDirectory (Split-Path -Parent "$file") -FilePath "$file" -ArgumentList "/S";
|
||||||
|
Remove-Item -Recurse $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Start-SoftwareInstaller {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[scriptblock] $Backup = $null,
|
||||||
|
[scriptblock] $Installer = $null,
|
||||||
|
[scriptblock] $Configurator = $null,
|
||||||
|
[scriptblock] $UserBackup = $null,
|
||||||
|
[scriptblock] $UserConfigurator = $null,
|
||||||
|
[Nullable[InstallerAction]] $Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
[InstallerAction] $Action = & {
|
||||||
|
if ($null -ne $Action) {
|
||||||
|
$Action;
|
||||||
|
} else {
|
||||||
|
[InstallerAction]::Install;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (-not $Name) {
|
||||||
|
$Name = Split-Path -Leaf (Split-Path -Parent ((Get-PSCallStack)[1].ScriptName));
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Operation {
|
||||||
|
if ($null -ne $Name) {
|
||||||
|
$Name = "``$Name``";
|
||||||
|
} else {
|
||||||
|
$Name = "unknown software";
|
||||||
|
}
|
||||||
|
|
||||||
|
$installHandler = {
|
||||||
|
param(
|
||||||
|
[InstallerAction] $Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
$Arguments ??= @{ };
|
||||||
|
|
||||||
|
$argumentList = @{
|
||||||
|
installer = $installHandler;
|
||||||
|
arguments = $Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
switch ($Action) {
|
||||||
|
([InstallerAction]::Backup) {
|
||||||
|
if ($Backup) {
|
||||||
|
Write-Host "Backing up $Name…";
|
||||||
|
& $Backup @argumentList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
([InstallerAction]::Install) {
|
||||||
|
if ($Installer) {
|
||||||
|
Write-Host "Installing $Name…";
|
||||||
|
& $Installer @argumentList;
|
||||||
|
}
|
||||||
|
|
||||||
|
& $installHandler @argumentList -Action ([InstallerAction]::Configure);
|
||||||
|
|
||||||
|
if ($UserConfigurator -and (-not (Test-SetupUser))) {
|
||||||
|
& $installHandler @argumentList -Action ([InstallerAction]::ConfigureUser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
([InstallerAction]::Configure) {
|
||||||
|
if ($Configurator) {
|
||||||
|
Write-Host "Configuring $Name…";
|
||||||
|
& $Configurator @argumentList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) {
|
||||||
|
$Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = $Arguments[$userArgument];
|
||||||
|
|
||||||
|
switch ($_) {
|
||||||
|
([InstallerAction]::BackupUser) {
|
||||||
|
if ($UserBackup) {
|
||||||
|
Write-Host "Backing up ``$Name`` for user ``$user``…";
|
||||||
|
& $UserBackup @argumentList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
([InstallerAction]::ConfigureUser) {
|
||||||
|
if ($UserConfigurator) {
|
||||||
|
Write-Host "Configuring $Name for user ``$user``…";
|
||||||
|
& $UserConfigurator @argumentList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
& $installHandler -Action $Action -Arguments $Arguments;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
121
scripts/Common/Scripts/SoftwareManagement.ps1
Normal file
121
scripts/Common/Scripts/SoftwareManagement.ps1
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
#!/bin/bash
|
||||||
|
function Install-SoftwarePackage($context, [string] $location, [string[]] $argumentList = @("/S"), [switch]$local) {
|
||||||
|
. "$PSScriptRoot/Context.ps1";
|
||||||
|
[Context]$context = $context;
|
||||||
|
[string]$filePath = "";
|
||||||
|
[string]$tempDir = $null;
|
||||||
|
|
||||||
|
if (-not ($local.IsPresent)) {
|
||||||
|
$tempDir = $context.GetTempDirectory();
|
||||||
|
Write-Information "Determining the file name of $location";
|
||||||
|
$fileName = ([uri]$location).Segments[-1];
|
||||||
|
Write-Information "$fileName";
|
||||||
|
$filePath = Join-Path $tempDir $fileName;
|
||||||
|
|
||||||
|
Write-Information "Downloading setup file from $location";
|
||||||
|
Invoke-WebRequest $location -OutFile $filePath;
|
||||||
|
} else {
|
||||||
|
$filePath = $location;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fileName = [System.IO.Path]::GetFileName($filePath);
|
||||||
|
Write-Information "Starting installation of $fileName";
|
||||||
|
Start-Process -Wait -FilePath $filePath -ArgumentList $argumentList;
|
||||||
|
|
||||||
|
if ($tempDir) {
|
||||||
|
Remove-Item -Recurse $tempDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether the specified package has been installed using Chocolatey.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the package to check.
|
||||||
|
#>
|
||||||
|
function Test-ChocoPackage {
|
||||||
|
[OutputType([bool])]
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
);
|
||||||
|
|
||||||
|
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether a `winget` package with the specified id is installed.
|
||||||
|
|
||||||
|
.PARAMETER ID
|
||||||
|
The id of the package to check.
|
||||||
|
#>
|
||||||
|
function Test-WingetPackage {
|
||||||
|
[OutputType([bool])]
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[string[]] $ArgumentList
|
||||||
|
)
|
||||||
|
|
||||||
|
& { $null = winget list --accept-source-agreements -e --id $Name @ArgumentList; $?; };
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether a command with the specified name exists.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the command to check.
|
||||||
|
#>
|
||||||
|
function Test-Command {
|
||||||
|
param (
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
[bool] (Get-Command $Name -ErrorAction SilentlyContinue);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether `winget` is working properly.
|
||||||
|
#>
|
||||||
|
function Test-Winget {
|
||||||
|
(Test-Command winget) -and (
|
||||||
|
& {
|
||||||
|
$output = winget source update winget;
|
||||||
|
|
||||||
|
$? -and -not ([System.Linq.Enumerable]::Any(
|
||||||
|
[string[]]($output),
|
||||||
|
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether a package with the specified name is installed.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the package to check.
|
||||||
|
#>
|
||||||
|
function Test-PSPackage {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
[bool] (Get-Package $Name -ErrorAction SilentlyContinue);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Checks whether a module with the specified name is installed.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the module to check.
|
||||||
|
#>
|
||||||
|
function Test-PSModule {
|
||||||
|
param(
|
||||||
|
[string] $Name
|
||||||
|
)
|
||||||
|
|
||||||
|
[bool](Get-Module -ListAvailable $Name -ErrorAction SilentlyContinue);
|
||||||
|
}
|
68
scripts/Common/Scripts/System.ps1
Normal file
68
scripts/Common/Scripts/System.ps1
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Creates a new temporary directory.
|
||||||
|
#>
|
||||||
|
function New-TemporaryDirectory {
|
||||||
|
$path = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName());
|
||||||
|
New-Item -ItemType Directory $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Removes desktop icons which apply to the specified pattern.
|
||||||
|
|
||||||
|
.PARAMETER Pattern
|
||||||
|
The pattern to match the icons to delete.
|
||||||
|
#>
|
||||||
|
function Remove-DesktopIcon {
|
||||||
|
param(
|
||||||
|
[string] $Pattern
|
||||||
|
)
|
||||||
|
|
||||||
|
$path = "Desktop/$Pattern";
|
||||||
|
|
||||||
|
foreach ($userDir in @("~", $env:PUBLIC, "$env:SystemDrive/Users/Default")) {
|
||||||
|
$fullName = "$userDir/$path";
|
||||||
|
|
||||||
|
if (Test-Path -PathType Leaf $fullName) {
|
||||||
|
Remove-Item $fullName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Adds a new shortcut to the start menu.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the icon to create.
|
||||||
|
|
||||||
|
.PARAMETER Target
|
||||||
|
The file to link to.
|
||||||
|
#>
|
||||||
|
function Add-StartMenuIcon {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[string] $Target
|
||||||
|
)
|
||||||
|
|
||||||
|
Import-Module KnownFolders;
|
||||||
|
Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1";
|
||||||
|
Install-ChocolateyShortcut -ShortcutFilePath "$((Get-KnownFolder "Common Programs").Path)/$Name.lnk" -TargetPath ((Get-Item $Target).FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Removes icons from the task bar.
|
||||||
|
|
||||||
|
.PARAMETER Pattern
|
||||||
|
The pattern of the icon names to remove.
|
||||||
|
#>
|
||||||
|
function Remove-TaskbarItem {
|
||||||
|
param(
|
||||||
|
[string] $Pattern
|
||||||
|
)
|
||||||
|
|
||||||
|
Import-Module -UseWindowsPowerShell PinnedItem;
|
||||||
|
Get-PinnedItem -Type TaskBar | Where-Object { $_.Name -like "$Pattern" } | ForEach-Object { Remove-PinnedItem $_ };
|
||||||
|
}
|
|
@ -1,15 +1,24 @@
|
||||||
#!/bin/env fish
|
#!/bin/env fish
|
||||||
function isConfigured -S
|
function isConfigured -S
|
||||||
set -q "$CONFIG_MODULE"
|
set -q "$CONFIG_NAME"
|
||||||
|
end
|
||||||
|
|
||||||
|
function getProfiles -S
|
||||||
|
source "$(status dirname)/eval-flake.fish";
|
||||||
|
evalFlake "" "" --apply "builtins.attrNames" --json
|
||||||
end
|
end
|
||||||
|
|
||||||
function getConfig -S -a property
|
function getConfig -S -a property
|
||||||
source "$(status dirname)/eval-module.fish"
|
source "$(status dirname)/eval-flake.fish"
|
||||||
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
|
evalFlake "$CONFIG_NAME" "$property" $argv[2..]
|
||||||
|
end
|
||||||
|
|
||||||
|
function getAttributes -S -a property
|
||||||
|
getConfig "$property" --apply "builtins.attrNames" --json
|
||||||
end
|
end
|
||||||
|
|
||||||
function getUsers -S
|
function getUsers -S
|
||||||
getConfig valhalla.users --apply "builtins.attrNames" --json
|
getAttributes "valhalla.users"
|
||||||
end
|
end
|
||||||
|
|
||||||
function isSet -S -a property
|
function isSet -S -a property
|
||||||
|
|
27
scripts/Common/Scripts/eval-flake.fish
Executable file
27
scripts/Common/Scripts/eval-flake.fish
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/env fish
|
||||||
|
function evalFlake --argument-names config property
|
||||||
|
set -l argv $argv[3..]
|
||||||
|
argparse --ignore-unknown "apply=" "json" -- $argv
|
||||||
|
|
||||||
|
if [ -z "$_flag_json" ]
|
||||||
|
set -a argv --raw
|
||||||
|
else
|
||||||
|
set -a argv --json
|
||||||
|
end
|
||||||
|
|
||||||
|
if [ -z "$_flag_apply" ]
|
||||||
|
set _flag_apply "_: _"
|
||||||
|
end
|
||||||
|
|
||||||
|
if [ -n "$config" ]
|
||||||
|
set config ".$config"
|
||||||
|
set _flag_apply "_: ($_flag_apply) ((import $(status dirname)/../../../lib/eval-attribute.nix) _)"
|
||||||
|
end
|
||||||
|
|
||||||
|
ROOT="$(realpath (status dirname))/../../.." \
|
||||||
|
PROPERTY="$property" \
|
||||||
|
nix eval --impure --extra-experimental-features "nix-command flakes" \
|
||||||
|
--apply "$_flag_apply" \
|
||||||
|
"$(status dirname)/../../..#valhalla$config" \
|
||||||
|
$argv
|
||||||
|
end
|
|
@ -25,7 +25,9 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||||
runInstaller userConfig "$name"
|
if [ "$name" != "$USER" ]
|
||||||
|
runInstaller userConfig "$name"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else if [ "$action" = "userConfig" ]
|
else if [ "$action" = "userConfig" ]
|
||||||
set -l name $argv[2]
|
set -l name $argv[2]
|
||||||
|
|
|
@ -14,7 +14,7 @@ then
|
||||||
UNPACKED_EXTENSION="${UNPACKED_EXTENSION}" \
|
UNPACKED_EXTENSION="${UNPACKED_EXTENSION}" \
|
||||||
EXTENSION_DIR="${EXTENSION_DIR}" \
|
EXTENSION_DIR="${EXTENSION_DIR}" \
|
||||||
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
|
EXTENSION_POLICY_DIR="${EXTENSION_POLICY_DIR}" \
|
||||||
bash "$BASH_SOURCE" "$USER";
|
bash --login "$BASH_SOURCE" "$USER";
|
||||||
else
|
else
|
||||||
keyFile="$UNPACKED_EXTENSION.pem";
|
keyFile="$UNPACKED_EXTENSION.pem";
|
||||||
extensionFile="$UNPACKED_EXTENSION.crx";
|
extensionFile="$UNPACKED_EXTENSION.crx";
|
||||||
|
|
57
scripts/Common/Software/Oh My Posh/Manage.ps1
Normal file
57
scripts/Common/Software/Oh My Posh/Manage.ps1
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
param (
|
||||||
|
$Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||||
|
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
Start-SoftwareInstaller @PSBoundParameters `
|
||||||
|
-Configurator {
|
||||||
|
Add-PowerShellProfileStatement `
|
||||||
|
-System `
|
||||||
|
-Category "oh-my-posh" `
|
||||||
|
-Script (
|
||||||
|
@(
|
||||||
|
"# Oh My Posh!",
|
||||||
|
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||||
|
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
||||||
|
) -join [System.Environment]::NewLine)
|
||||||
|
} `
|
||||||
|
-UserConfigurator {
|
||||||
|
param(
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
$theme = Get-UserConfig "oh-my-posh.theme";
|
||||||
|
|
||||||
|
if ($theme) {
|
||||||
|
$varName = "POSH_THEME";
|
||||||
|
|
||||||
|
if ($theme -isnot [string]) {
|
||||||
|
$root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh";
|
||||||
|
$path = Join-Path $root "$($theme.name).omp.json";
|
||||||
|
$null = New-Item -Force -ItemType Directory $root;
|
||||||
|
|
||||||
|
Set-Content $path (
|
||||||
|
& {
|
||||||
|
if ($IsWindows) {
|
||||||
|
wsl cat $theme.source
|
||||||
|
} else {
|
||||||
|
cat $theme.source
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$theme = [string] $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($IsWindows) {
|
||||||
|
[System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $path))", "User");
|
||||||
|
} else {
|
||||||
|
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||||
|
Add-EnvironmentVariable -User $Arguments.Name $varName ($path).Replace("~", "{{ .Home }}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
43
scripts/Common/Software/PowerShell/Manage.ps1
Normal file
43
scripts/Common/Software/PowerShell/Manage.ps1
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
param (
|
||||||
|
$Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||||
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
Start-SoftwareInstaller @PSBoundParameters `
|
||||||
|
-Configurator {
|
||||||
|
[string] $globalDir = $null;
|
||||||
|
$indicator = "# Profile Files";
|
||||||
|
|
||||||
|
if (-not $IsWindows) {
|
||||||
|
$globalDir = '"/etc/powershell/conf.d"';
|
||||||
|
} else {
|
||||||
|
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not ((Test-Path -PathType Leaf $PROFILE) -and ((Get-Content $PROFILE) -contains $indicator))) {
|
||||||
|
Add-PowerShellProfileStatement `
|
||||||
|
-DefaultUser `
|
||||||
|
-Script (@(
|
||||||
|
$indicator,
|
||||||
|
"`$globalDir = $globalDir",
|
||||||
|
({
|
||||||
|
$profileRoot = Split-Path -Parent $PROFILE;
|
||||||
|
|
||||||
|
$profilePaths = @(
|
||||||
|
"$profileRoot/conf.d/*.ps1",
|
||||||
|
"$globalDir/*.ps1"
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($profilePath in $profilePaths) {
|
||||||
|
if (Test-Path $profilePath) {
|
||||||
|
Get-Item $profilePath | ForEach-Object { . $_; };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).ToString()) -join "`n") `
|
||||||
|
-Append;
|
||||||
|
}
|
||||||
|
};
|
72
scripts/Common/Software/PowerShell/Module.ps1
Normal file
72
scripts/Common/Software/PowerShell/Module.ps1
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
. "$PSScriptRoot/../../Software/PowerShell/Profile.ps1";
|
||||||
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Generates the components for creating a module installer.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the module to install.
|
||||||
|
|
||||||
|
.PARAMETER NativeOnly
|
||||||
|
A value indicating whether the module is installed in Windows PowerShell only.
|
||||||
|
|
||||||
|
.PARAMETER NoProfile
|
||||||
|
A value indicating whether the module is not added to the profile script of users.
|
||||||
|
#>
|
||||||
|
function Get-ModuleInstallerComponents {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[switch] $NativeOnly,
|
||||||
|
[switch] $NoProfile
|
||||||
|
)
|
||||||
|
|
||||||
|
@{
|
||||||
|
arguments = @{
|
||||||
|
name = $Name;
|
||||||
|
nativeOnly = $NativeOnly;
|
||||||
|
};
|
||||||
|
installer = {
|
||||||
|
param(
|
||||||
|
[scriptblock] $Installer,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
$env:PENDING_MODULE_NAME = $Arguments.Name;
|
||||||
|
|
||||||
|
$installAction = {
|
||||||
|
$module = $env:PENDING_MODULE_NAME;
|
||||||
|
|
||||||
|
if (-not (Get-Module -ListAvailable $module -ErrorAction SilentlyContinue)) {
|
||||||
|
Install-Module -Scope AllUsers -Force $module @args;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (-not $Arguments.NativeOnly) {
|
||||||
|
& $installAction -AcceptLicense;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Command powershell) {
|
||||||
|
powershell -c ($installAction.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Remove-Item Env:\PENDING_MODULE_NAME;
|
||||||
|
& $Installer -Action ([InstallerAction]::Configure) @PSBoundParameters;
|
||||||
|
};
|
||||||
|
|
||||||
|
configurator = ($NoProfile.IsPresent) ? { } : {
|
||||||
|
param(
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
$name = $Arguments.Name;
|
||||||
|
|
||||||
|
Add-PowerShellProfileStatement `
|
||||||
|
-DefaultUser `
|
||||||
|
-Category $name `
|
||||||
|
-Script "Import-Module `"$name`";";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
123
scripts/Common/Software/PowerShell/Profile.ps1
Normal file
123
scripts/Common/Software/PowerShell/Profile.ps1
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/../../Scripts/Scripting.ps1";
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Adds an initialization script to the profile.
|
||||||
|
|
||||||
|
.PARAMETER System
|
||||||
|
A value indicating whether the script should be installed globally.
|
||||||
|
|
||||||
|
.PARAMETER DefaultUser
|
||||||
|
A value indicating whether the script should be installed to users by default.
|
||||||
|
|
||||||
|
.PARAMETER HomeDir
|
||||||
|
The path to the home directory of the user to install the script to.
|
||||||
|
|
||||||
|
.PARAMETER Category
|
||||||
|
The category name of the script to install.
|
||||||
|
|
||||||
|
.PARAMETER Script
|
||||||
|
The script to install.
|
||||||
|
|
||||||
|
.PARAMETER Replace
|
||||||
|
A value indicating whether the script should be replaced if it already exists.
|
||||||
|
|
||||||
|
.PARAMETER Append
|
||||||
|
A value indicating whether the content should be appended to the script if it already exists.
|
||||||
|
#>
|
||||||
|
function Add-PowerShellProfileStatement {
|
||||||
|
param(
|
||||||
|
[Parameter(ParameterSetName = "Global", Mandatory)]
|
||||||
|
[switch] $System,
|
||||||
|
[Parameter(ParameterSetName = "DefaultUser", Mandatory)]
|
||||||
|
[switch] $DefaultUser,
|
||||||
|
[Parameter(ParameterSetName = "Home")]
|
||||||
|
[string] $HomeDir = "~",
|
||||||
|
[Parameter(ParameterSetName = "Global", Mandatory)]
|
||||||
|
[Parameter(ParameterSetName = "DefaultUser")]
|
||||||
|
[Parameter(ParameterSetName = "Home")]
|
||||||
|
[string] $Category = $null,
|
||||||
|
[Parameter(Position = 0, Mandatory)]
|
||||||
|
[string] $Script,
|
||||||
|
[switch] $Replace,
|
||||||
|
[switch] $Append
|
||||||
|
)
|
||||||
|
|
||||||
|
[System.Collections.ArrayList] $profiles = @();
|
||||||
|
|
||||||
|
if ($System) {
|
||||||
|
[string] $configRoot = $null;
|
||||||
|
|
||||||
|
if ($IsWindows) {
|
||||||
|
# ToDo Change to "PowerShell"
|
||||||
|
$configRoot = "$env:ProgramData";
|
||||||
|
} else {
|
||||||
|
$configRoot = "/etc";
|
||||||
|
}
|
||||||
|
|
||||||
|
$profiles = @("$configRoot/powershell/.");
|
||||||
|
} else {
|
||||||
|
if ($DefaultUser) {
|
||||||
|
if (-not $IsWindows) {
|
||||||
|
$HomeDir = "/etc/skel";
|
||||||
|
} else {
|
||||||
|
$HomeDir = "C:/Users/Default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($shell in @("pwsh", "powershell")) {
|
||||||
|
if (Test-Command $shell) {
|
||||||
|
$null = $profiles.Add((& $shell -NoProfile -c '$PROFILE'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Push-Location ~;
|
||||||
|
|
||||||
|
$profiles = @(
|
||||||
|
$profiles |
|
||||||
|
ForEach-Object { [System.IO.Path]::GetRelativePath((Get-Location), $_) } |
|
||||||
|
ForEach-Object { "$HomeDir/$_" }
|
||||||
|
);
|
||||||
|
|
||||||
|
Pop-Location;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Category) {
|
||||||
|
$profiles = @($profiles | ForEach-Object { Join-Path (Split-Path -Parent $_) "conf.d" "$Category.ps1" });
|
||||||
|
}
|
||||||
|
|
||||||
|
$profiles | ForEach-Object {
|
||||||
|
$arguments = @{};
|
||||||
|
|
||||||
|
if ($Replace.IsPresent) {
|
||||||
|
$null = $arguments.Add("Replace", $Replace);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($Append.IsPresent) {
|
||||||
|
$null = $arguments.Add("Append", $Append);
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-PSScript @arguments `
|
||||||
|
-FileName $_ `
|
||||||
|
-Script $Script;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Creates an eval-script using the `[scriptblock]::Create` method.
|
||||||
|
|
||||||
|
.PARAMETER Initializer
|
||||||
|
The code to evaluate.
|
||||||
|
#>
|
||||||
|
function Get-ScriptInitializer {
|
||||||
|
param (
|
||||||
|
[Parameter(Position=0, Mandatory=$true)]
|
||||||
|
$Initializer
|
||||||
|
)
|
||||||
|
|
||||||
|
return ". ([scriptblock]::Create(($Initializer) -join `"``n`"))";
|
||||||
|
}
|
||||||
|
};
|
15
scripts/Common/Software/Terminal-Icons/Manage.ps1
Normal file
15
scripts/Common/Software/Terminal-Icons/Manage.ps1
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
param (
|
||||||
|
$Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../PowerShell/Module.ps1";
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
|
||||||
|
$parameters = Get-ModuleInstallerComponents "Terminal-Icons";
|
||||||
|
|
||||||
|
foreach ($key in $PSBoundParameters.Keys) {
|
||||||
|
$parameters.Add($key, $PSBoundParameters[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-SoftwareInstaller @parameters;
|
|
@ -14,5 +14,9 @@ begin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function userConfig -a name
|
||||||
|
sudo usermod -aG libvirt "$name"
|
||||||
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
end
|
end
|
||||||
|
|
15
scripts/Common/Software/aliae/Constants.ps1
Normal file
15
scripts/Common/Software/aliae/Constants.ps1
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets a powershell expression which points to the global `aliae` configuration.
|
||||||
|
#>
|
||||||
|
function Get-GlobalConfigExpression {
|
||||||
|
return "`"$($IsWindows ? "`$env:ProgramData" : "/etc")/aliae/aliae.yml`"";
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Gets the path to the global `aliae` configuration.
|
||||||
|
#>
|
||||||
|
function Get-GlobalConfigPath {
|
||||||
|
return & ([scriptblock]::Create((Get-GlobalConfigExpression)));
|
||||||
|
}
|
50
scripts/Common/Software/aliae/Main.ps1
Normal file
50
scripts/Common/Software/aliae/Main.ps1
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
param(
|
||||||
|
$Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/Constants.ps1";
|
||||||
|
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
|
||||||
|
Start-SoftwareInstaller @PSBoundParameters `
|
||||||
|
-Configurator {
|
||||||
|
. "$PSScriptRoot/Constants.ps1";
|
||||||
|
$pathExpression = Get-GlobalConfigExpression;
|
||||||
|
$path = Get-GlobalConfigPath;
|
||||||
|
$null = New-Item -Force -ItemType Directory (Split-Path -Parent $path);
|
||||||
|
Copy-Item -Force "$PSScriptRoot/aliae.yml" $path;
|
||||||
|
|
||||||
|
Add-PowerShellProfileStatement `
|
||||||
|
-System `
|
||||||
|
-Category "aliae" `
|
||||||
|
-Script (
|
||||||
|
@(
|
||||||
|
{
|
||||||
|
#aliae
|
||||||
|
},
|
||||||
|
"`$globalPath = $pathExpression",
|
||||||
|
{
|
||||||
|
$userPath = & {
|
||||||
|
if ($env:ALIAE_CONFIG) {
|
||||||
|
$env:ALIAE_CONFIG;
|
||||||
|
} else {
|
||||||
|
"~/.aliae.yaml";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Test-Path $globalPath) {
|
||||||
|
$null = & ([scriptblock]::Create((aliae init pwsh --config $globalPath))) *>&1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path $userPath) {
|
||||||
|
$null = & ([scriptblock]::Create((aliae init pwsh))) *>&1;
|
||||||
|
}
|
||||||
|
|
||||||
|
aliae completion powershell | Out-String | Invoke-Expression;
|
||||||
|
}
|
||||||
|
) -join [System.Environment]::NewLine)
|
||||||
|
} `
|
||||||
|
-UserConfigurator {
|
||||||
|
Copy-Item -Force "$PSScriptRoot/aliae.yml" ~/.aliae.yml;
|
||||||
|
};
|
98
scripts/Common/Software/aliae/Manage.ps1
Normal file
98
scripts/Common/Software/aliae/Manage.ps1
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
$null = New-Module {
|
||||||
|
. "$PSScriptRoot/Constants.ps1";
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Adds an alias to an existing `aliae` configuration.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the alias to add.
|
||||||
|
|
||||||
|
.PARAMETER Value
|
||||||
|
The script the alias should point to.
|
||||||
|
|
||||||
|
.PARAMETER User
|
||||||
|
The user to add the alias to.
|
||||||
|
#>
|
||||||
|
function Add-Alias {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[string] $Value,
|
||||||
|
[string] $User
|
||||||
|
)
|
||||||
|
|
||||||
|
Edit-Config `
|
||||||
|
-Variables @{
|
||||||
|
Name = "$Name";
|
||||||
|
Value = "$Value";
|
||||||
|
} `
|
||||||
|
".alias |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
|
||||||
|
-User $User;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Adds an environment variable to an existing `aliae` configuration.
|
||||||
|
|
||||||
|
.PARAMETER Name
|
||||||
|
The name of the variable to add.
|
||||||
|
|
||||||
|
.PARAMETER Value
|
||||||
|
The value of the variable.
|
||||||
|
#>
|
||||||
|
function Add-EnvironmentVariable {
|
||||||
|
param(
|
||||||
|
[string] $Name,
|
||||||
|
[string] $Value,
|
||||||
|
[string] $User
|
||||||
|
)
|
||||||
|
|
||||||
|
Edit-Config `
|
||||||
|
-Variables @{
|
||||||
|
Name = "$Name";
|
||||||
|
Value = "$Value";
|
||||||
|
} `
|
||||||
|
".env |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
|
||||||
|
-User $User;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Edits the underlying `aliae` configuration.
|
||||||
|
|
||||||
|
.PARAMETER Script
|
||||||
|
The yq script to run over the configuration.
|
||||||
|
|
||||||
|
.PARAMETER User
|
||||||
|
The user to edit the configuration for.
|
||||||
|
#>
|
||||||
|
function Edit-Config {
|
||||||
|
param(
|
||||||
|
[string] $Script,
|
||||||
|
[hashtable] $Variables,
|
||||||
|
[string] $User
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($User) {
|
||||||
|
$path = "$($IsWindows ? "~" : "$(sudo -u $User bash -c "realpath ~")")/.aliae.yaml";
|
||||||
|
} else {
|
||||||
|
$path = Get-GlobalConfigPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
Start-Job {
|
||||||
|
$file = New-TemporaryFile;
|
||||||
|
$variables = $using:Variables;
|
||||||
|
|
||||||
|
foreach ($key in $variables.Keys) {
|
||||||
|
Set-Item "Env:\$key" $variables[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
sudo -u $using:User cp $using:path $file;
|
||||||
|
yq -yi $using:Script $file;
|
||||||
|
sudo -u $using:User cp $file $using:path;
|
||||||
|
Remove-Item $file;
|
||||||
|
} | Receive-Job -Wait;
|
||||||
|
}
|
||||||
|
|
||||||
|
Export-ModuleMember -Function Add-Alias,Add-EnvironmentVariable;
|
||||||
|
};
|
|
@ -1,22 +1,4 @@
|
||||||
alias:
|
alias: []
|
||||||
- name: totsch
|
env: []
|
||||||
value: git
|
|
||||||
env:
|
|
||||||
- name: POSH_THEME
|
|
||||||
value: '{{ if eq .OS "windows" }}{{ .Home }}/Nextcloud/.omp{{ else }}/usr/local/share/oh-my-posh/themes{{ end }}/manuel.omp.json'
|
|
||||||
path: []
|
path: []
|
||||||
script:
|
script: []
|
||||||
- value: |
|
|
||||||
# Profile Files
|
|
||||||
$profileRoot = Split-Path -Parent $PROFILE;
|
|
||||||
$profilePaths = @(
|
|
||||||
"$profileRoot/conf.d/*.ps1",
|
|
||||||
"{{ if eq .OS "windows" }}$env:ProgramData{{ else }}/etc{{ end }}/powershell/conf.d/*.ps1"
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($profilePath in $profilePaths) {
|
|
||||||
if (Test-Path $profilePath) {
|
|
||||||
Get-Item $profilePath | ForEach-Object { . $_; };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if: match .Shell "pwsh"
|
|
||||||
|
|
|
@ -10,28 +10,35 @@ begin
|
||||||
function configureSW -V dir
|
function configureSW -V dir
|
||||||
source "$dir/../bash/profile.fish"
|
source "$dir/../bash/profile.fish"
|
||||||
source "$dir/../fish/profile.fish"
|
source "$dir/../fish/profile.fish"
|
||||||
set -l file /etc/aliae/aliae.yml
|
set -l file (pwsh -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1");
|
||||||
echo "export ALIAE_CONFIG=$(string escape "$file")" | sudo tee /etc/profile.d/aliae.sh
|
|
||||||
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"# aliae" \
|
"if [ -f $(string escape $file) ]" \
|
||||||
'eval "$(aliae init bash)"' \
|
'then' \
|
||||||
|
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
||||||
|
'fi' \
|
||||||
|
'' \
|
||||||
|
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
||||||
|
'then' \
|
||||||
|
' eval "$(aliae init bash)"' \
|
||||||
|
'fi' \
|
||||||
|
'' \
|
||||||
'eval "$(aliae completion bash)"'
|
'eval "$(aliae completion bash)"'
|
||||||
end | installBashProfile "aliae" "aliae"
|
end | installBashProfile "aliae" "aliae"
|
||||||
|
|
||||||
begin
|
|
||||||
printf %s\n "" \
|
|
||||||
"# aliae" \
|
|
||||||
'eval "$(aliae init bash)"' \
|
|
||||||
'eval "$(aliae completion bash)"'
|
|
||||||
end | sudo tee /etc/skel/.bashrc > /dev/null
|
|
||||||
|
|
||||||
if type -q fish
|
if type -q fish
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"aliae init fish | source" \
|
"if [ -f $(string escape $file) ]" \
|
||||||
|
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
||||||
|
'end' \
|
||||||
|
'' \
|
||||||
|
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
||||||
|
' aliae init fish | source' \
|
||||||
|
'end' \
|
||||||
|
'' \
|
||||||
"aliae completion fish | source"
|
"aliae completion fish | source"
|
||||||
end | installFishProfile "aliae" "aliae"
|
end | installFishProfile "aliae" "aliae"
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,12 +17,22 @@ begin
|
||||||
if type -q "$bins[$i]"
|
if type -q "$bins[$i]"
|
||||||
set bin "$bins[$i]"
|
set bin "$bins[$i]"
|
||||||
set extensionRoot "$extensionRoots[$i]"
|
set extensionRoot "$extensionRoots[$i]"
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
BROWSER_BIN="$bin" \
|
BROWSER_BIN="$bin" \
|
||||||
EXTENSION_POLICY_DIR="$braveExtensions" \
|
EXTENSION_POLICY_DIR="$extensionRoot" \
|
||||||
bash "$dir/../Chromium/ytmdl.sh"
|
bash "$dir/../Chromium/ytmdl.sh"
|
||||||
|
|
||||||
|
for i in (seq (count $bins))
|
||||||
|
if [ "$extensionRoots[$i]" != "$extensionRoot" ]
|
||||||
|
if [ -d "$extensionRoots[$i]" ]
|
||||||
|
sudo rm -rf "$extensionRoots[$i]"
|
||||||
|
sudo ln -s "$extensionRoot" "$extensionRoots[$i]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
113
scripts/Common/Software/git/Manage.ps1
Normal file
113
scripts/Common/Software/git/Manage.ps1
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
param (
|
||||||
|
$Action,
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||||
|
. "$PSScriptRoot/../../Scripts/System.ps1";
|
||||||
|
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||||
|
|
||||||
|
$null = New-Module {
|
||||||
|
param(
|
||||||
|
[hashtable] $Parameters
|
||||||
|
)
|
||||||
|
|
||||||
|
$configure = {
|
||||||
|
param(
|
||||||
|
[string] $User
|
||||||
|
)
|
||||||
|
|
||||||
|
$root = "valhalla";
|
||||||
|
|
||||||
|
if ($User) {
|
||||||
|
$root = "$root$($IsWindows ? ".windows" : '').users.$User";
|
||||||
|
$sudoArgs = @("-u", $User);
|
||||||
|
$configArgs = @("--global");
|
||||||
|
} else {
|
||||||
|
$sudoArgs = @();
|
||||||
|
$configArgs = @("--system");
|
||||||
|
}
|
||||||
|
|
||||||
|
$config = Get-Config "$root.git";
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Sets a configuration option in git.
|
||||||
|
#>
|
||||||
|
function Set-GitConfig {
|
||||||
|
sudo @sudoArgs git config @configArgs $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((-not $IsWindows) -or $User) {
|
||||||
|
$branch = $config.defaultBranch;
|
||||||
|
|
||||||
|
if ($branch) {
|
||||||
|
Set-GitConfig "init.defaultBranch" $branch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($User) {
|
||||||
|
$displayName = Get-UserConfig "displayName";
|
||||||
|
$mailAddress = Get-UserConfig "mailAddress";
|
||||||
|
|
||||||
|
if ($displayName) {
|
||||||
|
Set-GitConfig "user.name" $displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mailAddress) {
|
||||||
|
Set-GitConfig "user.email" $mailAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Git Flow
|
||||||
|
. {
|
||||||
|
$dir = New-TemporaryDirectory;
|
||||||
|
$key = "flow";
|
||||||
|
$mainBranch = $config."$key".mainBranch;
|
||||||
|
$devBranch = $config."$key".devBranch;
|
||||||
|
|
||||||
|
& {
|
||||||
|
git -C "$dir" init;
|
||||||
|
git -C "$dir" config user.name "PortValhalla";
|
||||||
|
git -C "$dir" config user.email "no-reply@valhal.la";
|
||||||
|
git -C "$dir" commit --allow-empty -m "Initial commit";
|
||||||
|
git -C "$dir" branch master;
|
||||||
|
git -C "$dir" branch dev;
|
||||||
|
git -C "$dir" flow init --defaults;
|
||||||
|
} | Out-Null;
|
||||||
|
|
||||||
|
if ($mainBranch) {
|
||||||
|
git -C "$dir" branch $mainBranch | Out-Null;;
|
||||||
|
sudo @sudoArgs git -C "$dir" flow config set @configArgs master $mainBranch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($devBranch) {
|
||||||
|
git -C "$dir" branch $devBranch | Out-Null;
|
||||||
|
sudo @sudoArgs git -C "$dir" flow config set @configArgs develop $devBranch;
|
||||||
|
}
|
||||||
|
|
||||||
|
Remove-Item -Recurse -Force $dir;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
[PSCustomObject] $aliases = $config.aliases;
|
||||||
|
|
||||||
|
if ($aliases) {
|
||||||
|
foreach ($alias in ($aliases | Get-Member -MemberType Properties)) {
|
||||||
|
Set-GitConfig "alias.$($alias.Name)" $aliases.$($alias.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Start-SoftwareInstaller @Parameters `
|
||||||
|
-Configurator {
|
||||||
|
& $configure @PSBoundParameters;
|
||||||
|
} `
|
||||||
|
-UserConfigurator {
|
||||||
|
param(
|
||||||
|
[hashtable] $Arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
& $configure -User $Arguments.Name;
|
||||||
|
};
|
||||||
|
} $PSBoundParameters;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue