diff options
Diffstat (limited to 'init-sh/lib.sh')
-rw-r--r-- | init-sh/lib.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/init-sh/lib.sh b/init-sh/lib.sh index ec93c61..ee046a9 100644 --- a/init-sh/lib.sh +++ b/init-sh/lib.sh @@ -43,6 +43,35 @@ AddRules () { fi } +AddBegRules() { + string=$1 + file=$2 + quiet=$3 + ctrl=0 + + if [[ -z ${string} ]]; then + return; + fi + + if [[ -z ${quiet} ]]; then + echo "Modifying config in ${file}..." + fi + + mv ${file} /tmp/secure.tmp + + if ! grep -Eqx "^${string}" /tmp/secure.tmp; then + echo -e "${COMMENT}" >> ${file}; + echo -e "${string}" >> ${file}; + fi + + cat /tmp/secure.tmp >> ${file} + + if [[ -z ${3} ]]; then + echo -e "done.\n" + fi +} + + CleanRules() { file=$1 ctrl=0 |