diff --git a/deploy/cicd/deb/deb-conffiles b/deploy/cicd/deb/deb-conffiles index e1cc76aa..4e963881 100644 --- a/deploy/cicd/deb/deb-conffiles +++ b/deploy/cicd/deb/deb-conffiles @@ -1,3 +1,2 @@ /etc/osctrl/osctrl-{{ OSCTRL_COMPONTENT }}/service.json -/usr/share/osctrl/db.json.example -/usr/share/osctrl/redis.json.example +/etc/systemd/system/osctrl-{{ OSCTRL_COMPONTENT }}.service \ No newline at end of file diff --git a/deploy/cicd/deb/generate-deb-package.sh b/deploy/cicd/deb/generate-deb-package.sh index f078a120..e13fa0bf 100755 --- a/deploy/cicd/deb/generate-deb-package.sh +++ b/deploy/cicd/deb/generate-deb-package.sh @@ -36,15 +36,17 @@ cp deploy/cicd/deb/deb-conffiles "${DEB_DIR}/DEBIAN/conffiles" && \ ###################################### Example configs ###################################### -cp deploy/config/db.json "${DEB_DIR}/usr/share/osctrl/db.json.example" && \ - chmod 640 "${DEB_DIR}/usr/share/osctrl/db.json.example" +mkdir -p "${DEB_DIR}/tmp/osctrl-${OSCTRL_COMPONTENT}" -cp deploy/config/redis.json "${DEB_DIR}/usr/share/osctrl/redis.json.example" && \ - chmod 640 "${DEB_DIR}/usr/share/osctrl/redis.json.example" +cp deploy/config/db.json "${DEB_DIR}/tmp/osctrl-${OSCTRL_COMPONTENT}/db.json.example" && \ + chmod 640 "${DEB_DIR}/tmp/osctrl-${OSCTRL_COMPONTENT}/db.json.example" + +cp deploy/config/redis.json "${DEB_DIR}/tmp/osctrl-${OSCTRL_COMPONTENT}/redis.json.example" && \ + chmod 640 "${DEB_DIR}/tmp/osctrl-${OSCTRL_COMPONTENT}/redis.json.example" ###################################### General components content ###################################### -mkdir -p "${DEB_DIR}/etc/osctrl/osctrl-${OSCTRL_COMPONTENT}" && \ +mkdir -p "${DEB_DIR}/etc/osctrl/osctrl-${OSCTRL_COMPONTENT}" cp osctrl-${OSCTRL_COMPONTENT}-${GOOS}-${GOARCH}.bin "${DEB_DIR}/usr/local/bin/osctrl-${OSCTRL_COMPONTENT}" && \ chmod 755 "${DEB_DIR}/usr/local/bin/osctrl-${OSCTRL_COMPONTENT}" diff --git a/deploy/cicd/deb/post-init.sh b/deploy/cicd/deb/post-init.sh index 17580475..609cf82c 100644 --- a/deploy/cicd/deb/post-init.sh +++ b/deploy/cicd/deb/post-init.sh @@ -8,6 +8,20 @@ then chown root:osctrl -R /etc/osctrl/osctrl-{{ OSCTRL_COMPONTENT }} fi +################### Copy common configs ################### +if [ ! -f /usr/share/osctrl/db.json.example ] +then + cp /tmp/osctrl-{{ OSCTRL_COMPONTENT }}/db.json.example /usr/share/osctrl/db.json.example + chown root:root /usr/share/osctrl/db.json.example +fi + +if [ ! -f /usr/share/osctrl/redis.json.example ] +then + cp /tmp/osctrl-{{ OSCTRL_COMPONTENT }}/redis.json.example /usr/share/osctrl/redis.json.example + chown root:root /usr/share/osctrl/redis.json.example +fi +rm -rd /tmp/osctrl-{{ OSCTRL_COMPONTENT }} + ################### osctrl-admin web assets ################### if [ -d "/usr/share/osctrl/tmpl_admin" ] then