-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite of user config, major improvements
For the full changelog and remaining todos, refer to: https://github.com/bevry/dorothy/discussions/24 Closes #23 #17 Signed-off-by: Benjamin Lupton <b@lupton.cc>
- Loading branch information
Showing
117 changed files
with
1,680 additions
and
1,074 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
source "$DOROTHY/sources/strict.bash" | ||
|
||
config-set "$1" "$2" "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
source "$DOROTHY/sources/strict.bash" | ||
|
||
# dependencies | ||
env QUIET=y setup-util-ripgrep | ||
|
||
# options | ||
file="$1" # /etc/systemd/resolved.conf | ||
find="$2" # Domains | ||
|
||
rg -o "^$find=(.+)" --replace '$1' < "$file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
source "$DOROTHY/sources/strict.bash" | ||
|
||
# dependencies | ||
env QUIET=y setup-util-ripgrep | ||
|
||
# options | ||
file="$1" # /etc/systemd/resolved.conf | ||
content="$(cat "$file")" | ||
find="$2" # Domains | ||
pattern="^[#]?$find=.+?\n" | ||
replace="$3" # Domains=~. | ||
|
||
# act, replacing inline | ||
sudo touch "$file" | ||
if rg -q "$pattern" <<< "$content"; then | ||
(rg --passthru "$pattern" --replace "$replace" <<< "$content") > "$file" | ||
else | ||
echo -e "$content\n\n$replace" > "$file" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
#!/usr/bin/env bash | ||
source "$DOROTHY/sources/strict.bash" | ||
|
||
# dependencies | ||
env QUIET=y setup-util-sd | ||
|
||
# options | ||
file="$1" # /etc/systemd/resolved.conf | ||
find="$2" # Domains | ||
pattern="^[#]?$find=.+?\n" | ||
replace="$3" # Domains=~. | ||
|
||
env QUIET=y setup-util-sd | ||
|
||
# act, replacing at the end | ||
sudo touch "$file" | ||
contents="$(sd -p "^[#]?$find=.+?\n" '' < "$file")" | ||
if is-nonempty-string "$contents"; then | ||
contents="$(sd -p "$pattern" '' < "$file")" | ||
if test -n "$contents"; then | ||
contents+="\n" | ||
fi | ||
echo -e "$contents$replace" | sudo tee "$file" &> /dev/null # silent everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.