SHA256
initial commit. builds but not tested
This commit is contained in:
1 parent
3cd2ec2aa2
commit
da2d80592c
14 files changed
+468
No files matched your search
Executable
+157
@@ -0,0 +1,157 @@
|
||||
SUMMARY = "This recipe will automatically install the OpenPLC Runtime Environment"
|
||||
HOMEPAGE = "https://autonomylogic.com/"
|
||||
LICENSE = "MIT"
|
||||
|
||||
#SRC_URI:append = "file://sdaglue.service"
|
||||
SRC_URI:append = "git://github.com/Autonomy-Logic/openplc-runtime.git;protocol=https;branch=main \
|
||||
file://openplc.service \
|
||||
file://fake_root.patch \
|
||||
"
|
||||
SRCREV = "cd9825b703f17c0d5db2fc99c5454f3cf822f3b3"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=1e9650a938047d709b897ea200cd0a71"
|
||||
|
||||
#UNPACKDIR = "${D}/openplc"
|
||||
#WORKDIR = "${D}/openplc"
|
||||
OPENPLC_USER = "plc"
|
||||
|
||||
inherit systemd cmake pkgconfig
|
||||
|
||||
#do_configure:prepend() {
|
||||
#rm -rf ${S}/*
|
||||
#mkdir -p ${D}/openplc
|
||||
#rm -rf ${D}/openplc/*
|
||||
#}
|
||||
#do_unpack:append() {
|
||||
#}
|
||||
do_install[network] = "1"
|
||||
INHIBIT_PACKAGE_STRIP = "1"
|
||||
PACKAGE_STRIP = "no"
|
||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
||||
do_install() {
|
||||
mkdir -p ${D}/openplc
|
||||
#chown ${OPENPLC_USER} ${D}/openplc
|
||||
#TODO make this more granular. openplc depends on some files from the source to be present on the final system, but surely not all of them.
|
||||
#cp -r ${S}/* ${D}/openplc
|
||||
#find ${S}/* -type f -exec install -Dm 755 -o ${OPENPLC_USER} "{}" "${D}/openplc/{}" \;
|
||||
export tmppwd=${PWD}
|
||||
#cd ${S}
|
||||
#find ./ -type f -exec install -Dm 755 "{}" "${D}/openplc/{}" \;
|
||||
#cd $tmppwd
|
||||
#cd ${D}/openplc
|
||||
#chroot ${D}
|
||||
export D="${D}/openplc"
|
||||
export TGTPY=$(find ${D}/../../../python3 -type l -wholename */image${PYTHON} -executable)
|
||||
echo "find ${B}/python3 -type l -wholename */image${PYTHON} -executable)"
|
||||
#export PYDIR="${STAGING_LIBDIR}"
|
||||
#mkdir ${D}/openplc
|
||||
#${D}/openplc/install.sh
|
||||
#/openplc/install.sh
|
||||
#exit
|
||||
#cd $tmppwd
|
||||
|
||||
|
||||
${S}/install.sh
|
||||
#grep -rlw ${S}/venvs -e "${S}" | xargs sed -i -e "s|${S}|/|g"
|
||||
|
||||
cp ${S}/start_openplc.sh ${D}/openplc
|
||||
#cp -r ${S}/venvs ${D}/openplc #bitbake seems to have a problem with either stripping these files out or giving incorrect ownership
|
||||
#rm -rf ${D}/openplc/venvs/opcua
|
||||
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/greenlet"
|
||||
#rm -rf "${D}/openplc/venvs/runtime/lib/python3.12/site-packages/sqlalchemy"
|
||||
|
||||
cp -r ${S}/scripts ${D}/openplc
|
||||
cp -r ${S}/webserver ${D}/openplc
|
||||
mkdir -p ${D}/openplc/build/
|
||||
cp ${S}/build/plc_main ${D}/openplc/build
|
||||
cp -r ${S}/build/plugins ${D}/openplc/build
|
||||
|
||||
|
||||
#cp -r ${S}/* ${D}/openplc
|
||||
#${D}/openplc/install.sh
|
||||
|
||||
rm -rf ${D}/var
|
||||
|
||||
find ${D} -name *.pyc -delete
|
||||
#find ${D}/openplc/venvs -name python3 -delete #should hopefully only kil symlinks
|
||||
#grep -rlw ${D}/openplc/venvs -e "${D}" | xargs sed -i -e "s|${D}|/|g"
|
||||
#grep -rlw ${D}/openplc -e ${TMPDIR} | xargs sed -i -e "s|${TMPDIR}|/tmp|g" #this should maybe pipe to rm -f instead?
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0755 ${UNPACKDIR}/openplc.service ${D}${systemd_system_unitdir}/openplc.service
|
||||
|
||||
#bbwarn "attempting to install service"
|
||||
#${D}${BIN_FILE} service install
|
||||
#bbwarn "attempting to start service"
|
||||
#${D}${BIN_FILE} service start
|
||||
|
||||
}
|
||||
|
||||
#addtask do_populate_sdk before do_install after do_fetch_sources
|
||||
|
||||
do_package:append() {
|
||||
#the following scrubs all instances of tmpdir from the target files. This will probably break things
|
||||
#os.system('grep -Rnw ${D}/openplc -e ${D} | sed -i -e "s|${D}|/|g"')
|
||||
#os.system('grep -Rnw ${D}/openplc -e ${TMPDIR} | sed -i -e "s|${TMPDIR}|/|g"') #this should maybe pipe to rm -f instead?
|
||||
}
|
||||
|
||||
INHERIT += "extrausers"
|
||||
EXTRA_USERS_PARAMS += " useradd ${OPENPLC_USER}; \
|
||||
usermod -p '\$6\$TNPZD8XEuoDZWxLo\$WOIudv2UA5eePqcX0qgiS.o0feNZow1cAq9OnYLIZYsE6Jq2n.G/7792z73lx0h6EpBr/FUZpEqIDpWliK7Oy.' ${OPENPLC_USER}; \
|
||||
"
|
||||
|
||||
|
||||
|
||||
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
|
||||
SYSTEMD_SERVICE:${PN} = "openplc.service"
|
||||
SYSTEMD_AUTO_ENABLE:${PN} = "enable"
|
||||
|
||||
DEPENDS = "\
|
||||
python3 \
|
||||
python3-pip \
|
||||
pkgconfig \
|
||||
cmake \
|
||||
pkgconfig-native \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN} = "\
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
python3-modules \
|
||||
python3-pymodbus \
|
||||
python3-greenlet \
|
||||
python3-sqlalchemy \
|
||||
python3-psutil \
|
||||
python3-markupsafe \
|
||||
python3-asyncua \
|
||||
python3-pyserial \
|
||||
python3-flask \
|
||||
python3-cryptography \
|
||||
python3-pytest \
|
||||
python3-pytest-asyncio \
|
||||
python3-pytest-mock \
|
||||
python3-psutil \
|
||||
python3-bcrypt \
|
||||
python3-socketio \
|
||||
python3-python-dotenv \
|
||||
python3-pyjwt \
|
||||
python3-flask-sqlalchemy \
|
||||
python3-pre-commit \
|
||||
python3-flask-jwt-extended \
|
||||
python3-flask-login \
|
||||
python3-aiomqtt \
|
||||
bash \
|
||||
"
|
||||
#python3-dev
|
||||
#python3-yaml
|
||||
#iproute
|
||||
#nc
|
||||
FILES:${PN} = "\
|
||||
/var \
|
||||
/run \
|
||||
/run/runtime \
|
||||
/openplc \
|
||||
/openplc/* \
|
||||
${systemd_system_unitdir}/openplc.service \
|
||||
"
|
||||
|
||||
Reference in new issue
Block a user