Merge claude/1
This commit is contained in:
commit
9a694115ac
@ -80,33 +80,33 @@ appGenerate()
|
|||||||
|
|
||||||
local result=$(createFolders "loud" $docker_install_user $install_containers_dir$app_name)
|
local result=$(createFolders "loud" $docker_install_user $install_containers_dir$app_name)
|
||||||
checkSuccess "Creating new folder named $app_name"
|
checkSuccess "Creating new folder named $app_name"
|
||||||
local result=$(sudo cp -r $install_containers_dir/template/* $install_containers_dir$app_name)
|
local result=$(runInstallOp cp -r $install_containers_dir/template/* $install_containers_dir$app_name)
|
||||||
checkSuccess "Copying template files to the $app_name folder"
|
checkSuccess "Copying template files to the $app_name folder"
|
||||||
local result=$(sudo mv $install_containers_dir$app_name/template.sh "$app_script_file")
|
local result=$(runInstallOp mv $install_containers_dir$app_name/template.sh "$app_script_file")
|
||||||
checkSuccess "Renaming script file for $app_name"
|
checkSuccess "Renaming script file for $app_name"
|
||||||
local result=$(sudo mv $install_containers_dir$app_name/template.config "$app_config_file")
|
local result=$(runInstallOp mv $install_containers_dir$app_name/template.config "$app_config_file")
|
||||||
checkSuccess "Renaming config file for $app_name"
|
checkSuccess "Renaming config file for $app_name"
|
||||||
|
|
||||||
# Script updates
|
# Script updates
|
||||||
local result=$(sudo sed -i '' -e 's/Template/'"$cap_first_app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/Template/'"$cap_first_app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.sh - all cases of Template to $cap_first_app_name"
|
checkSuccess "Update $app_name.sh - all cases of Template to $cap_first_app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/template/'"$app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/template/'"$app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.sh - all cases of template to $app_name"
|
checkSuccess "Update $app_name.sh - all cases of template to $app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/TEMPLATE/'"$full_caps_app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/TEMPLATE/'"$full_caps_app_name"'/g' "$app_script_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.sh - all cases of TEMPLATE to $full_caps_app_name"
|
checkSuccess "Update $app_name.sh - all cases of TEMPLATE to $full_caps_app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/old/'"$app_category"'/g' "$app_script_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/old/'"$app_category"'/g' "$app_script_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Updating $app_name.sh - category to $app_category"
|
checkSuccess "Updating $app_name.sh - category to $app_category"
|
||||||
local result=$(sudo sed -i '' -e 's/Placeholder!/'"$app_description"'/g' "$app_script_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/Placeholder!/'"$app_description"'/g' "$app_script_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Updating $app_name.sh - description to $app_description"
|
checkSuccess "Updating $app_name.sh - description to $app_description"
|
||||||
|
|
||||||
# Config updates
|
# Config updates
|
||||||
local result=$(sudo sed -i '' -e 's/Template/'"$cap_first_app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/Template/'"$cap_first_app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.config - all cases of Template to $cap_first_app_name"
|
checkSuccess "Update $app_name.config - all cases of Template to $cap_first_app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/template/'"$app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/template/'"$app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.config - all cases of template to $app_name"
|
checkSuccess "Update $app_name.config - all cases of template to $app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/TEMPLATE/'"$full_caps_app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/TEMPLATE/'"$full_caps_app_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Update $app_name.config - all cases of TEMPLATE to $full_caps_app_name"
|
checkSuccess "Update $app_name.config - all cases of TEMPLATE to $full_caps_app_name"
|
||||||
local result=$(sudo sed -i '' -e 's/HOST_NAME=test/HOST_NAME='"$host_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
local result=$(runInstallOp sed -i '' -e 's/HOST_NAME=test/HOST_NAME='"$host_name"'/g' "$app_config_file" > /dev/null 2>&1)
|
||||||
checkSuccess "Updating Config - HOST_NAME to $app_name"
|
checkSuccess "Updating Config - HOST_NAME to $app_name"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
@ -119,7 +119,7 @@ appGenerate()
|
|||||||
isNotice "Please provide a valid input."
|
isNotice "Please provide a valid input."
|
||||||
done
|
done
|
||||||
if [[ "$app_docker_compose" == [yY] ]]; then
|
if [[ "$app_docker_compose" == [yY] ]]; then
|
||||||
sudo $CFG_TEXT_EDITOR "$install_containers_dir$app_name/docker-compose.yml"
|
$CFG_TEXT_EDITOR "$install_containers_dir$app_name/docker-compose.yml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
@ -132,7 +132,7 @@ appGenerate()
|
|||||||
isNotice "Please provide a valid input."
|
isNotice "Please provide a valid input."
|
||||||
done
|
done
|
||||||
if [[ "$app_config" == [yY] ]]; then
|
if [[ "$app_config" == [yY] ]]; then
|
||||||
sudo $CFG_TEXT_EDITOR "$install_containers_dir$app_name/$app_name.config"
|
$CFG_TEXT_EDITOR "$install_containers_dir$app_name/$app_name.config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
@ -145,7 +145,7 @@ appGenerate()
|
|||||||
isNotice "Please provide a valid input."
|
isNotice "Please provide a valid input."
|
||||||
done
|
done
|
||||||
if [[ "$app_script" == [yY] ]]; then
|
if [[ "$app_script" == [yY] ]]; then
|
||||||
sudo $CFG_TEXT_EDITOR "$install_containers_dir$app_name/$app_name.sh"
|
$CFG_TEXT_EDITOR "$install_containers_dir$app_name/$app_name.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|||||||
@ -104,16 +104,20 @@ localDnsApplyPihole() {
|
|||||||
local hosts tmp h n
|
local hosts tmp h n
|
||||||
hosts=$(localDnsAppHosts)
|
hosts=$(localDnsAppHosts)
|
||||||
if [[ -z "$hosts" ]]; then isNotice "No app hosts for Pi-hole — skipping."; return 0; fi
|
if [[ -z "$hosts" ]]; then isNotice "No app hosts for Pi-hole — skipping."; return 0; fi
|
||||||
tmp=$(sudo mktemp)
|
# $list lives under containers/pihole (docker-install-owned): read/write it
|
||||||
if [[ -f "$list" ]]; then # preserve anything outside our block
|
# via the container-owner helpers; build the new content in a manager /tmp
|
||||||
sudo awk -v b="$b" -v e="$e" '$0==b{skip=1} !skip{print} $0==e{skip=0}' "$list" | sudo tee "$tmp" >/dev/null
|
# scratch in between.
|
||||||
|
tmp=$(mktemp)
|
||||||
|
if runFileOp test -f "$list"; then # preserve anything outside our block
|
||||||
|
runFileOp cat "$list" | awk -v b="$b" -v e="$e" '$0==b{skip=1} !skip{print} $0==e{skip=0}' > "$tmp"
|
||||||
fi
|
fi
|
||||||
{
|
{
|
||||||
echo "$b"
|
echo "$b"
|
||||||
while IFS= read -r h; do [[ -n "$h" ]] && echo "${ip} ${h}"; done <<< "$hosts"
|
while IFS= read -r h; do [[ -n "$h" ]] && echo "${ip} ${h}"; done <<< "$hosts"
|
||||||
echo "$e"
|
echo "$e"
|
||||||
} | sudo tee -a "$tmp" >/dev/null
|
} >> "$tmp"
|
||||||
sudo cp "$tmp" "$list"; sudo rm -f "$tmp"
|
runFileWrite "$list" < "$tmp"
|
||||||
|
rm -f "$tmp"
|
||||||
n=$(printf '%s\n' "$hosts" | grep -c .)
|
n=$(printf '%s\n' "$hosts" | grep -c .)
|
||||||
dockerCommandRun "docker exec pihole-service pihole restartdns" >/dev/null 2>&1 || dockerComposeRestart pihole
|
dockerCommandRun "docker exec pihole-service pihole restartdns" >/dev/null 2>&1 || dockerComposeRestart pihole
|
||||||
isSuccessful "Pi-hole custom.list updated: ${n} hosts -> ${ip}"
|
isSuccessful "Pi-hole custom.list updated: ${n} hosts -> ${ip}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user