picloud deploy
This commit is contained in:
@@ -1,11 +1,24 @@
|
|||||||
|
project(picloud)
|
||||||
|
import_version(${PROJECT_NAME} pip)
|
||||||
|
set_deploy_property(${PROJECT_NAME}
|
||||||
|
LABEL "PIP Cloud dispatcher"
|
||||||
|
FULLNAME "${pip_DOMAIN}.picloud"
|
||||||
|
COMPANY "${pip_COMPANY}"
|
||||||
|
INFO "PIP Cloud dispatcher")
|
||||||
|
make_rc(${PROJECT_NAME} RC)
|
||||||
list(APPEND PIP_UTILS_LIST "picloud")
|
list(APPEND PIP_UTILS_LIST "picloud")
|
||||||
set(PIP_UTILS_LIST ${PIP_UTILS_LIST} PARENT_SCOPE)
|
set(PIP_UTILS_LIST ${PIP_UTILS_LIST} PARENT_SCOPE)
|
||||||
file(GLOB CPPS "*.cpp")
|
file(GLOB CPPS "*.cpp")
|
||||||
file(GLOB HDRS "*.h")
|
file(GLOB HDRS "*.h")
|
||||||
add_executable(picloud ${CPPS} ${HDRS})
|
add_executable(${PROJECT_NAME} ${CPPS} ${HDRS} ${RC})
|
||||||
target_link_libraries(picloud pip pip_cloud pip_console)
|
target_link_libraries(${PROJECT_NAME} pip pip_cloud pip_console)
|
||||||
if (DEFINED LIB)
|
if (DEFINED LIB)
|
||||||
install(TARGETS picloud DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||||
else()
|
else()
|
||||||
install(TARGETS picloud DESTINATION bin)
|
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||||
endif()
|
endif()
|
||||||
|
deploy_target(${PROJECT_NAME}
|
||||||
|
DEPLOY_DIR ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
DESTINATION ${ROOT_DIR}/release
|
||||||
|
DEB_ADD_SERVICE
|
||||||
|
)
|
||||||
|
|||||||
16
utils/cloud_dispatcher/debian-service/DEBIAN/postinst
Normal file
16
utils/cloud_dispatcher/debian-service/DEBIAN/postinst
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
if [ "$action" = "configure" ]; then
|
||||||
|
cp /opt/org.SHS.picloud/picloud.service /etc/systemd/system/
|
||||||
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
|
systemctl enable shs-server >/dev/null || true
|
||||||
|
systemctl start shs-server >/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
#dpkg-maintscript-helper rm_conffile /etc/network/if-up.d/openssh-server 1:7.9p1-1~ -- "$@"
|
||||||
|
|
||||||
|
exit 0
|
||||||
20
utils/cloud_dispatcher/debian-service/DEBIAN/postrm
Normal file
20
utils/cloud_dispatcher/debian-service/DEBIAN/postrm
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
|
||||||
|
#if [ "$action" = "purge" ] ; then
|
||||||
|
#
|
||||||
|
#fi
|
||||||
|
#dpkg-maintscript-helper rm_conffile /etc/network/if-up.d/openssh-server 1:7.9p1-1~ -- "$@"
|
||||||
|
|
||||||
|
if [ "$action" = "remove" ]; then
|
||||||
|
systemctl disable picloud >/dev/null || true
|
||||||
|
rm /etc/systemd/system/picloud.service
|
||||||
|
systemctl --system daemon-reload >/dev/null || true
|
||||||
|
if which deluser >/dev/null 2>&1; then
|
||||||
|
deluser --quiet shs > /dev/null || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
25
utils/cloud_dispatcher/debian-service/DEBIAN/preinst
Normal file
25
utils/cloud_dispatcher/debian-service/DEBIAN/preinst
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
if [ "$action" = "install" ]; then
|
||||||
|
gr=dialout
|
||||||
|
if grep -q gpio /etc/group; then
|
||||||
|
gr=$gr,gpio
|
||||||
|
fi
|
||||||
|
useradd --system --create-home --home-dir /var/lib/shs --shell /usr/sbin/nologin --groups $gr shs
|
||||||
|
fi
|
||||||
|
#if [ "$action" = upgrade ] || [ "$action" = install ]
|
||||||
|
#then
|
||||||
|
# if dpkg --compare-versions "$version" lt 1:5.5p1-6 && \
|
||||||
|
# [ -d /run/sshd ]; then
|
||||||
|
# # make sure /run/sshd is not removed on upgrades
|
||||||
|
# touch /run/sshd/.placeholder
|
||||||
|
# fi
|
||||||
|
#fi
|
||||||
|
|
||||||
|
#dpkg-maintscript-helper rm_conffile /etc/network/if-up.d/openssh-server 1:7.9p1-1~ -- "$@"
|
||||||
|
|
||||||
|
exit 0
|
||||||
10
utils/cloud_dispatcher/debian-service/DEBIAN/prerm
Normal file
10
utils/cloud_dispatcher/debian-service/DEBIAN/prerm
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
|
||||||
|
#dpkg-maintscript-helper rm_conffile /etc/network/if-up.d/openssh-server 1:7.9p1-1~ -- "$@"
|
||||||
|
|
||||||
|
systemctl stop picloud >/dev/null || true
|
||||||
|
|
||||||
|
exit 0
|
||||||
18
utils/cloud_dispatcher/debian-service/picloud.service
Normal file
18
utils/cloud_dispatcher/debian-service/picloud.service
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=PIP Cloud dispatcher
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/var/lib/shs
|
||||||
|
|
||||||
|
User=shs
|
||||||
|
Group=shs
|
||||||
|
|
||||||
|
ExecStart=/opt/org.SHS.picloud/picloud
|
||||||
|
|
||||||
|
TimeoutStopSec=30
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user