Merge claude/1
This commit is contained in:
commit
03d7a7b969
@ -44,7 +44,7 @@ dockerConfigSetupToContainer()
|
|||||||
if [ "$silent_flag" == "loud" ]; then
|
if [ "$silent_flag" == "loud" ]; then
|
||||||
isNotice "Copying config file to '$target_path/$config_file'..."
|
isNotice "Copying config file to '$target_path/$config_file'..."
|
||||||
fi
|
fi
|
||||||
copyFile "$silent_flag" "$source_file" "$target_path/$config_file" $sudo_user_name | sudo tee -a "$logs_dir/$docker_log_file" 2>&1
|
copyFile "$silent_flag" "$source_file" "$target_path/$config_file" $sudo_user_name | runFileWrite -a "$logs_dir/$docker_log_file" 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$config_overrides" ]]; then
|
if [[ -n "$config_overrides" ]]; then
|
||||||
@ -60,9 +60,9 @@ dockerConfigSetupToContainer()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if sudo grep -qE 'RANDOMIZED(PASSWORD|USERNAME|BCRYPTPASSWORD|HEX|VAPID|APPKEY)[0-9]*' "$target_path/$config_file" 2>/dev/null; then
|
if runFileOp grep -qE 'RANDOMIZED(PASSWORD|USERNAME|BCRYPTPASSWORD|HEX|VAPID|APPKEY)[0-9]*' "$target_path/$config_file" 2>/dev/null; then
|
||||||
scanFileForRandomPasswordKeysUsers "$target_path/$config_file"
|
scanFileForRandomPasswordKeysUsers "$target_path/$config_file"
|
||||||
sudo chmod a+r "$target_path/$config_file" 2>/dev/null || true
|
runFileOp chmod a+r "$target_path/$config_file" 2>/dev/null || true
|
||||||
source "$target_path/$config_file"
|
source "$target_path/$config_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ dockerConfigSetupToContainer()
|
|||||||
if [[ "$flags" == "install" ]]; then
|
if [[ "$flags" == "install" ]]; then
|
||||||
if [ -f "$target_path/$config_file" ]; then
|
if [ -f "$target_path/$config_file" ]; then
|
||||||
# Same content check
|
# Same content check
|
||||||
if sudo cmp -s "$source_file" "$target_path/$config_file"; then
|
if runFileOp cmp -s "$source_file" "$target_path/$config_file"; then
|
||||||
isNotice "Config file for $app_name contains no edits."
|
isNotice "Config file for $app_name contains no edits."
|
||||||
while true; do
|
while true; do
|
||||||
#isQuestion "? (y/n): "
|
#isQuestion "? (y/n): "
|
||||||
@ -91,11 +91,11 @@ dockerConfigSetupToContainer()
|
|||||||
case $editconfigaccept in
|
case $editconfigaccept in
|
||||||
[yY])
|
[yY])
|
||||||
# Calculate checksum of the original file
|
# Calculate checksum of the original file
|
||||||
local original_checksum=$(sudo md5sum "$target_path/$config_file")
|
local original_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
# Open the file with $CFG_TEXT_EDITOR for editing
|
# Open the file with $CFG_TEXT_EDITOR for editing
|
||||||
sudo $CFG_TEXT_EDITOR "$target_path/$config_file"
|
runFileOp $CFG_TEXT_EDITOR "$target_path/$config_file"
|
||||||
# Calculate checksum of the edited file
|
# Calculate checksum of the edited file
|
||||||
local edited_checksum=$(sudo md5sum "$target_path/$config_file")
|
local edited_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
# Compare the checksums to check if changes were made
|
# Compare the checksums to check if changes were made
|
||||||
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
||||||
source $target_path/$config_file
|
source $target_path/$config_file
|
||||||
@ -124,7 +124,7 @@ dockerConfigSetupToContainer()
|
|||||||
case $resetconfigaccept in
|
case $resetconfigaccept in
|
||||||
[yY])
|
[yY])
|
||||||
isNotice "Resetting $app_name config file."
|
isNotice "Resetting $app_name config file."
|
||||||
copyFile "loud" "$source_file" "$target_path/$config_file" $docker_install_user | sudo tee -a "$logs_dir/$docker_log_file" 2>&1
|
copyFile "loud" "$source_file" "$target_path/$config_file" $docker_install_user | runFileWrite -a "$logs_dir/$docker_log_file" 2>&1
|
||||||
source $target_path/$config_file
|
source $target_path/$config_file
|
||||||
dockerConfigSetupToContainer "loud" $app_name;
|
dockerConfigSetupToContainer "loud" $app_name;
|
||||||
while true; do
|
while true; do
|
||||||
@ -135,13 +135,13 @@ dockerConfigSetupToContainer()
|
|||||||
case $editconfigaccept in
|
case $editconfigaccept in
|
||||||
[yY])
|
[yY])
|
||||||
# Calculate the checksum of the original file
|
# Calculate the checksum of the original file
|
||||||
local original_checksum=$(sudo md5sum "$target_path/$config_file")
|
local original_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Open the file with $CFG_TEXT_EDITOR for editing
|
# Open the file with $CFG_TEXT_EDITOR for editing
|
||||||
sudo $CFG_TEXT_EDITOR "$target_path/$config_file"
|
runFileOp $CFG_TEXT_EDITOR "$target_path/$config_file"
|
||||||
|
|
||||||
# Calculate the checksum of the edited file
|
# Calculate the checksum of the edited file
|
||||||
local edited_checksum=$(sudo md5sum "$target_path/$config_file")
|
local edited_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Compare the checksums to check if changes were made
|
# Compare the checksums to check if changes were made
|
||||||
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
||||||
@ -170,13 +170,13 @@ dockerConfigSetupToContainer()
|
|||||||
case $editconfigaccept in
|
case $editconfigaccept in
|
||||||
[yY])
|
[yY])
|
||||||
# Calculate the checksum of the original file
|
# Calculate the checksum of the original file
|
||||||
local original_checksum=$(sudo md5sum "$target_path/$config_file")
|
local original_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Open the file with $CFG_TEXT_EDITOR for editing
|
# Open the file with $CFG_TEXT_EDITOR for editing
|
||||||
sudo $CFG_TEXT_EDITOR "$target_path/$config_file"
|
runFileOp $CFG_TEXT_EDITOR "$target_path/$config_file"
|
||||||
|
|
||||||
# Calculate the checksum of the edited file
|
# Calculate the checksum of the edited file
|
||||||
local edited_checksum=$(sudo md5sum "$target_path/$config_file")
|
local edited_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Compare the checksums to check if changes were made
|
# Compare the checksums to check if changes were made
|
||||||
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
||||||
@ -204,7 +204,7 @@ dockerConfigSetupToContainer()
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
isNotice "Config file for $app_name does not exist. Creating it..."
|
isNotice "Config file for $app_name does not exist. Creating it..."
|
||||||
copyFile "loud" "$source_file" "$target_path/$config_file" $docker_install_user | sudo tee -a "$logs_dir/$docker_log_file" 2>&1
|
copyFile "loud" "$source_file" "$target_path/$config_file" $docker_install_user | runFileWrite -a "$logs_dir/$docker_log_file" 2>&1
|
||||||
isNotice "Config file for $app_name contains no edits."
|
isNotice "Config file for $app_name contains no edits."
|
||||||
while true; do
|
while true; do
|
||||||
#isQuestion "Would you like to make edits to the config file? (y/n): "
|
#isQuestion "Would you like to make edits to the config file? (y/n): "
|
||||||
@ -214,13 +214,13 @@ dockerConfigSetupToContainer()
|
|||||||
case $editconfigaccept in
|
case $editconfigaccept in
|
||||||
[yY])
|
[yY])
|
||||||
# Calculate the checksum of the original file
|
# Calculate the checksum of the original file
|
||||||
local original_checksum=$(sudo md5sum "$target_path/$config_file")
|
local original_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Open the file with $CFG_TEXT_EDITOR for editing
|
# Open the file with $CFG_TEXT_EDITOR for editing
|
||||||
sudo $CFG_TEXT_EDITOR "$target_path/$config_file"
|
runFileOp $CFG_TEXT_EDITOR "$target_path/$config_file"
|
||||||
|
|
||||||
# Calculate the checksum of the edited file
|
# Calculate the checksum of the edited file
|
||||||
local edited_checksum=$(sudo md5sum "$target_path/$config_file")
|
local edited_checksum=$(runFileOp md5sum "$target_path/$config_file")
|
||||||
|
|
||||||
# Compare the checksums to check if changes were made
|
# Compare the checksums to check if changes were made
|
||||||
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
if [[ "$original_checksum" != "$edited_checksum" ]]; then
|
||||||
|
|||||||
@ -27,13 +27,20 @@ runFileOp() {
|
|||||||
# Write stdin to a path with the right privilege (replaces `… | sudo tee path`).
|
# Write stdin to a path with the right privilege (replaces `… | sudo tee path`).
|
||||||
# rooted -> sudo tee
|
# rooted -> sudo tee
|
||||||
# rootless -> tee as the Docker install user
|
# rootless -> tee as the Docker install user
|
||||||
# Usage: some_command | runFileWrite /path/to/file
|
# Pass -a/--append as the first arg to append instead of truncate (replaces
|
||||||
|
# `… | sudo tee -a path`, e.g. the /docker/logs log-append idiom).
|
||||||
|
# Usage: some_command | runFileWrite [-a] /path/to/file
|
||||||
runFileWrite() {
|
runFileWrite() {
|
||||||
|
local append=""
|
||||||
|
if [[ "$1" == "-a" || "$1" == "--append" ]]; then
|
||||||
|
append=" -a"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
local dest="$1"
|
local dest="$1"
|
||||||
if [[ "$CFG_DOCKER_INSTALL_TYPE" == "rootless" ]]; then
|
if [[ "$CFG_DOCKER_INSTALL_TYPE" == "rootless" ]]; then
|
||||||
dockerCommandRunInstallUser "tee '$dest' >/dev/null"
|
dockerCommandRunInstallUser "tee$append '$dest' >/dev/null"
|
||||||
else
|
else
|
||||||
sudo tee "$dest" >/dev/null
|
sudo tee$append "$dest" >/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user