Compare commits
3 commits
2680dce208
...
6b1c97956d
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 6b1c97956d | ||
Manuel Thalmann | 0ebe9ace15 | ||
Manuel Thalmann | 051019072a |
|
@ -1,7 +1,7 @@
|
|||
#!/bin/env fish
|
||||
set -l dir (status dirname)
|
||||
source "$dir/../Scripts/config.fish"
|
||||
set -l users (getConfig valhalla.users --apply "builtins.attrNames" --json)
|
||||
set -l users (getUsers)
|
||||
|
||||
|
||||
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||
|
@ -24,6 +24,4 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
|||
while ! sudo passwd "$name"
|
||||
echo "An error occurred! Please try again."
|
||||
end
|
||||
|
||||
source "$dir/../Software/git/main.fish" configure user "$name"
|
||||
end
|
||||
|
|
|
@ -4,6 +4,10 @@ function getConfig -S -a property
|
|||
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
|
||||
end
|
||||
|
||||
function getUsers -S
|
||||
getConfig valhalla.users --apply "builtins.attrNames" --json
|
||||
end
|
||||
|
||||
function isSet -S -a property
|
||||
not test "$(getConfig "$property" --json)" = "null"
|
||||
end
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -a installed
|
||||
|
||||
function getSWName
|
||||
end
|
||||
set -l dir (status dirname)
|
||||
|
||||
function installSW
|
||||
end
|
||||
|
@ -11,18 +8,29 @@ begin
|
|||
function configureSW
|
||||
end
|
||||
|
||||
function runInstaller -a action
|
||||
function userConfig -a user
|
||||
end
|
||||
|
||||
function runInstaller -V dir -a action
|
||||
if [ -z "$action" ] || [ "$action" = "install" ]
|
||||
set -a installed (getSWName)
|
||||
installSW $argv[2..]
|
||||
else if [ "$action" = "configure" ]
|
||||
if [ -z (getSWName) ] || contains (getSWName) $installed
|
||||
configureSW $argv[2..]
|
||||
else
|
||||
printf %s%s\n \
|
||||
"$(tput setaf 3)Warning:$(tput sgr0) " \
|
||||
"$(getSWName) does not seem to be installed -- Skipping"
|
||||
configureSW $argv[2..]
|
||||
|
||||
source "$dir/config.fish"
|
||||
set -l users (getUsers)
|
||||
|
||||
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||
runInstaller userConfig "$name"
|
||||
end
|
||||
else if [ "$action" = "userConfig" ]
|
||||
set -l name $argv[2]
|
||||
|
||||
if [ -z "$name" ]
|
||||
set name "$USER"
|
||||
end
|
||||
|
||||
userConfig "$name" $argv[3..]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,13 +3,9 @@ begin
|
|||
set -l dir (status dirname)
|
||||
source "$(status dirname)/../../Scripts/software.fish"
|
||||
|
||||
function getSWName
|
||||
echo "git"
|
||||
end
|
||||
|
||||
function configureSW -S -V dir -a scope name
|
||||
function configureGit -S -V dir -a name
|
||||
source "$dir/../../Scripts/config.fish"
|
||||
set -l root
|
||||
set -l root "valhalla"
|
||||
set -l user
|
||||
set -l configArgs
|
||||
|
||||
|
@ -17,12 +13,11 @@ begin
|
|||
sudo -u "$user" git config $configArgs $argv
|
||||
end
|
||||
|
||||
if [ -z "$scope" ] || [ "$scope" = "system" ]
|
||||
set root "valhalla"
|
||||
if [ -z "$user" ]
|
||||
set user "root"
|
||||
set configArgs "--system"
|
||||
else
|
||||
set root "valhalla.users.$name"
|
||||
set root "$root.users.$name"
|
||||
set user "$name"
|
||||
set configArgs "--global"
|
||||
set -l displayName "$root.displayName"
|
||||
|
@ -86,5 +81,13 @@ begin
|
|||
end
|
||||
end
|
||||
|
||||
function configureSW -S -V dir
|
||||
configureGit
|
||||
end
|
||||
|
||||
function userConfig -S -V dir -a name
|
||||
configureGit "$name"
|
||||
end
|
||||
|
||||
runInstaller $argv
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue