-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(distrib): added generic x86_64 profile (#4451)
* feat(distrib): addded generic x86_64 profile Signed-off-by: Marcello Martina <[email protected]> * fix: corrected property in kura.properties Signed-off-by: Marcello Martina <[email protected]> --------- Signed-off-by: Marcello Martina <[email protected]>
- Loading branch information
1 parent
43bafac
commit 0ba65f0
Showing
12 changed files
with
927 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
kura/distrib/src/main/resources/generic-x86_64/deb/control/control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Eurotech | ||
# | ||
Package: kura | ||
Version: [[project.version]] | ||
Section: misc | ||
Priority: low | ||
Depends: openjdk-8-jre-headless | temurin-8-jdk | openjdk-17-jre-headless | temurin-17-jdk, | ||
network-manager, bind9, isc-dhcp-server, iw, | ||
bluez, bluez-hcidump, | ||
iptables, | ||
chrony, ntpdate, cron, | ||
telnet, dos2unix, unzip | ||
Recommends: python3 | ||
Architecture: all | ||
Maintainer: [email protected] | ||
Description: Kura is an inclusive software framework that puts a layer | ||
between the operating system and the customer application, with industry | ||
standard interfaces that shorten custom development time, simplified coding | ||
and software that can be easily ported from one hardware platform | ||
to another. |
101 changes: 101 additions & 0 deletions
101
kura/distrib/src/main/resources/generic-x86_64/deb/control/postinst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Eurotech | ||
# | ||
|
||
INSTALL_DIR=/opt/eclipse | ||
TIMESTAMP=`date +%Y%m%d%H%M%S` | ||
LOG=/tmp/kura_install_${TIMESTAMP}.log | ||
WD_TMP_FILE=/tmp/watchdog | ||
REFRESH_TIME=5 | ||
TIMEOUT_TIME=300 | ||
|
||
############################################## | ||
# UTILITY FUNCTIONS | ||
############################################## | ||
# Run postInstall function and start watchdog if needed | ||
function runPostInstall { | ||
if [ -f "${WD_TMP_FILE}" ]; then | ||
WATCHDOG_DEVICE=`cat ${WD_TMP_FILE}` | ||
echo "Got watchdog ${WATCHDOG_DEVICE}" >> $LOG 2>&1 | ||
postInstall & | ||
PID=$! | ||
START=$(date +%s) | ||
|
||
while [ -d "/proc/$PID" ]; do | ||
echo w > ${WATCHDOG_DEVICE} | ||
DELTA=$(($(date +%s) - $START)) | ||
if [ "$DELTA" -ge "$TIMEOUT_TIME" ]; then | ||
echo "The installation process is not responding. It'll be stopped." | ||
kill -9 $PID >> /dev/null 2>&1 | ||
fi | ||
sleep $REFRESH_TIME | ||
done | ||
stopWatchdog | ||
else | ||
postInstall & | ||
PID=$! | ||
START=$(date +%s) | ||
|
||
while [ -d "/proc/$PID" ]; do | ||
DELTA=$(($(date +%s) - $START)) | ||
if [ "$DELTA" -ge "$TIMEOUT_TIME" ]; then | ||
echo "The installation process is not responding. It'll be stopped." | ||
kill -9 $PID >> /dev/null 2>&1 | ||
fi | ||
sleep $REFRESH_TIME | ||
done | ||
fi | ||
} | ||
|
||
# Deactivate watchdog device if possible | ||
function stopWatchdog { | ||
if [ -n "${WATCHDOG_DEVICE}" ]; then | ||
echo V > ${WATCHDOG_DEVICE} | ||
fi | ||
} | ||
|
||
# Pre-install script | ||
function postInstall { | ||
mkdir -p ${INSTALL_DIR} >> ${LOG} 2>&1 | ||
unzip /tmp/kura_*.zip -d ${INSTALL_DIR} >> ${LOG} 2>&1 | ||
|
||
#install KURA files | ||
sh ${INSTALL_DIR}/kura_*/install/kura_install.sh >> ${LOG} 2>&1 | ||
|
||
#clean up | ||
rm -rf ${INSTALL_DIR}/kura/install >> ${LOG} 2>&1 | ||
rm /tmp/kura_*.zip >> ${LOG} 2>&1 | ||
|
||
#move the log file | ||
mkdir -p ${INSTALL_DIR}/kura/log | ||
mv ${LOG} ${INSTALL_DIR}/kura/log/ | ||
|
||
#flush all cached filesystem to disk | ||
sync | ||
|
||
echo "" | ||
echo "Finished. KURA has been installed to ${INSTALL_DIR}/kura and will start automatically after a reboot" | ||
} | ||
############################################## | ||
# END UTILITY FUNCTIONS | ||
############################################## | ||
|
||
############################################## | ||
# POST INSTALL SCRIPT | ||
############################################## | ||
runPostInstall | ||
exit 0 | ||
############################################# | ||
# END POST INSTALL SCRIPT | ||
############################################## | ||
|
106 changes: 106 additions & 0 deletions
106
kura/distrib/src/main/resources/generic-x86_64/deb/control/preinst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2023 Eurotech and/or its affiliates and others | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Eurotech | ||
# | ||
|
||
INSTALL_DIR=/opt/eclipse | ||
WD_TMP_FILE=/tmp/watchdog | ||
REFRESH_TIME=5 | ||
TIMEOUT_TIME=300 | ||
|
||
############################################## | ||
# UTILITY FUNCTIONS | ||
############################################## | ||
# Run preInstall function and start watchdog if needed | ||
function runPreInstall { | ||
if [ -f "${WD_TMP_FILE}" ]; then | ||
WATCHDOG_DEVICE=`cat ${WD_TMP_FILE}` | ||
preInstall & | ||
PID=$! | ||
START=$(date +%s) | ||
|
||
while [ -d "/proc/$PID" ]; do | ||
echo w > ${WATCHDOG_DEVICE} | ||
DELTA=$(($(date +%s) - $START)) | ||
if [ "$DELTA" -ge "$TIMEOUT_TIME" ]; then | ||
echo "The installation process is not responding. It'll be stopped." | ||
kill -9 $PID >> /dev/null 2>&1 | ||
fi | ||
sleep $REFRESH_TIME | ||
done | ||
stopWatchdog | ||
else | ||
preInstall & | ||
PID=$! | ||
START=$(date +%s) | ||
|
||
while [ -d "/proc/$PID" ]; do | ||
DELTA=$(($(date +%s) - $START)) | ||
if [ "$DELTA" -ge "$TIMEOUT_TIME" ]; then | ||
echo "The installation process is not responding. It'll be stopped." | ||
kill -9 $PID >> /dev/null 2>&1 | ||
fi | ||
sleep $REFRESH_TIME | ||
done | ||
fi | ||
} | ||
|
||
# Deactivate watchdog device if possible | ||
function stopWatchdog { | ||
if [ -n "${WATCHDOG_DEVICE}" ]; then | ||
echo V > ${WATCHDOG_DEVICE} | ||
fi | ||
} | ||
|
||
# Pre-install script | ||
function preInstall { | ||
#clean up old installation if present | ||
rm -fr /opt/eclipse/kura* >> /tmp/kura_install.log 2>&1 | ||
rm -fr ${INSTALL_DIR}/kura* >> /tmp/kura_install.log 2>&1 | ||
rm -fr /tmp/.kura/ >> /tmp/kura_install.log 2>&1 | ||
rm /etc/init.d/firewall >> /tmp/kura_install.log 2>&1 | ||
rm /tmp/coninfo-* >> /tmp/kura_install.log 2>&1 | ||
rm /var/log/kura.log >> /tmp/kura_install.log 2>&1 | ||
rm -f kura-*.zip >> /tmp/kura_install.log 2>&1 | ||
rm -f kura_*.zip >> /tmp/kura_install.log 2>&1 | ||
echo "" | ||
} | ||
############################################## | ||
# END UTILITY FUNCTIONS | ||
############################################## | ||
|
||
############################################## | ||
# PRE-INSTALL SCRIPT | ||
############################################## | ||
PIDS=`pgrep java` | ||
|
||
echo "" | ||
echo "Installing Kura..." | ||
echo "Installing Kura..." > /tmp/kura_install.log 2>&1 | ||
|
||
#Kill JVM and monit for installation | ||
if [ -f "/var/run/kura.pid" ] ; then | ||
KURA_PID=`cat /var/run/kura.pid` | ||
|
||
for pid in "${PIDS[@]}" | ||
do | ||
if [ "$KURA_PID" == "$pid" ] ; then | ||
`kill $pid` >> /tmp/kura_install.log 2>&1 | ||
fi | ||
done | ||
fi | ||
|
||
runPreInstall | ||
############################################## | ||
# END PRE-INSTALL SCRIPT | ||
############################################## | ||
|
Oops, something went wrong.