2024-07-13 13:12:35 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
set -l dir (status dirname)
|
2024-11-01 14:32:43 +00:00
|
|
|
source "$dir/../../lib/action.fish"
|
2024-07-13 13:12:35 +00:00
|
|
|
|
2024-11-01 14:32:43 +00:00
|
|
|
function installAction -V dir
|
|
|
|
source "$dir/../../lib/hooks.fish"
|
2024-12-05 09:40:59 +00:00
|
|
|
source "$dir/../../lib/restoration.fish"
|
2024-07-13 13:12:35 +00:00
|
|
|
|
2024-09-12 21:17:04 +00:00
|
|
|
if not type -q getDeploymentScript
|
|
|
|
function getDeploymentScript
|
|
|
|
echo "No deployment script specified! No software will be installed." 1>&2
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-13 15:36:29 +00:00
|
|
|
set -l deployScript (getDeploymentScript)
|
2024-12-05 09:40:59 +00:00
|
|
|
initBackupConfig --action restore
|
2024-07-13 13:49:55 +00:00
|
|
|
runHook initialize || true
|
2024-09-13 13:10:29 +00:00
|
|
|
and runHook installOS || true
|
2024-07-19 22:46:02 +00:00
|
|
|
|
2024-09-13 13:31:42 +00:00
|
|
|
and runHook installSoftware || begin
|
2024-09-22 22:23:41 +00:00
|
|
|
echo "Installing software..."
|
|
|
|
|
|
|
|
and if [ -n "$deployScript" ]
|
2024-09-13 15:36:29 +00:00
|
|
|
source $deployScript
|
|
|
|
end
|
|
|
|
end
|
2024-09-12 21:17:04 +00:00
|
|
|
|
2024-09-26 22:54:27 +00:00
|
|
|
and runHook addUsers || begin
|
|
|
|
source "$dir/users.fish"
|
|
|
|
end
|
|
|
|
|
2024-09-13 15:36:29 +00:00
|
|
|
runHook initializeUsers || begin
|
|
|
|
if [ -n "$deployScript" ]
|
2024-11-01 12:12:16 +00:00
|
|
|
source "$dir/../../lib/settings.fish"
|
2024-09-22 22:23:41 +00:00
|
|
|
|
2024-12-05 15:34:24 +00:00
|
|
|
for name in (getUsers | jq '.[]' --raw-output0 | string split0 || true)
|
2024-09-22 22:23:41 +00:00
|
|
|
echo "Configuring user `$name`..."
|
2024-11-28 21:11:56 +00:00
|
|
|
and source $deployScript userConfig --user $name
|
2024-09-13 15:36:29 +00:00
|
|
|
end
|
2024-09-12 21:17:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-13 13:31:42 +00:00
|
|
|
and runHook postInstall || true
|
2024-09-22 13:14:42 +00:00
|
|
|
|
|
|
|
and begin
|
2024-09-22 22:23:41 +00:00
|
|
|
echo "Cleaning installation scripts..."
|
2024-09-22 13:14:42 +00:00
|
|
|
set -l projectPath (realpath "$(status dirname)/../../..")
|
|
|
|
cd (dirname "$projectPath")
|
2024-11-01 13:13:41 +00:00
|
|
|
# sudo rm -rf "$projectPath"
|
2024-09-22 13:14:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
and echo "The installation finished successfully!"
|
2024-09-19 20:29:50 +00:00
|
|
|
and echo "This machine will reboot in 5 seconds..."
|
|
|
|
and echo "Press CTRL-C to abort..."
|
|
|
|
and sleep 5
|
2024-12-08 16:18:59 +00:00
|
|
|
and sudo systemctl reboot -i
|
2024-07-13 13:12:35 +00:00
|
|
|
end
|
2024-11-01 14:32:43 +00:00
|
|
|
|
|
|
|
runSetupUserAction installAction
|