+ gen_files_yml.sh
This commit is contained in:
parent
84dd5a1932
commit
eb756d0fbc
40
config/gen_files_yml.sh
Executable file
40
config/gen_files_yml.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
tab() {
|
||||
sed -e "s/^/$(printf %$1s)/"
|
||||
}
|
||||
|
||||
not_empty() {
|
||||
sed -e "/^$/d"
|
||||
}
|
||||
|
||||
define(){ IFS='\n' read -r -d '' ${1} || true; }
|
||||
|
||||
#ls -l | tab 10
|
||||
|
||||
define FILE_OPTS_COMMON <<'EOF'
|
||||
encoding: gzip+base64
|
||||
owner: root:root
|
||||
permissions: '0644'
|
||||
EOF
|
||||
|
||||
print_file() {
|
||||
CONTENT=$(cat $1 | gzip | base64)
|
||||
echo "- path: $2"
|
||||
cat <<< $FILE_OPTS_COMMON | not_empty | tab 2
|
||||
echo " content: |"
|
||||
cat <<< $CONTENT | tab 4
|
||||
echo " "
|
||||
}
|
||||
|
||||
gen__write_files() {
|
||||
echo "write_files:"
|
||||
print_file src/srv1cv83@.service /etc/systemd/system/srv1cv83@.service | tab 2
|
||||
print_file src/srv1cv83-ras@.service /etc/systemd/system/srv1cv83-ras@.service | tab 2
|
||||
print_file src/apache-proxy /etc/nginx/sites-available/apache-proxy | tab 2
|
||||
}
|
||||
|
||||
pushd config
|
||||
gen__write_files | tab 4
|
||||
popd
|
||||
|
Loading…
Reference in New Issue
Block a user