Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUMMARY = "Flight computer image"

IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL} packagegroup-core-ssh-openssh kernel-modules i2c-tools libgpiod libgpiod-dev libgpiod-tools srp-startup"
IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL} packagegroup-core-ssh-openssh kernel-modules i2c-tools libgpiod libgpiod-dev libgpiod-tools htop srp srp-recover srp-user"

IMAGE_LINGUAS = " "

Expand Down
54 changes: 54 additions & 0 deletions recipes-core/srp-recover/files/srp_recover.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

out_put_file="/srp/token/token.hex"
out_put_file_ver="/srp/token/token.hex.sha1"

if [ ! -d "/srp/update" ]; then
cd /srp
mkdir update
echo "[SRP-PLATFORM]: [INFO] SRP sw dir added"
fi

if [ ! -d "/srp/update/backup" ]; then
cd /srp/update
mkdir backup
echo "[SRP-PLATFORM]: [INFO] Backup dir added"
fi

if [ ! -d "/srp/update/new" ]; then
cd /srp/update
mkdir new
echo "[SRP-PLATFORM]: [INFO] New dir added"
fi

if [ ! -d "/srp/update/current" ]; then
cd /srp/update
mkdir current
echo "[SRP-PLATFORM]: [INFO] Current dir added"
fi

if [ ! -e "/srp/token/token.hex" ]
then
if [ ! -d "/srp/token" ]; then
cd /srp
mkdir token
fi
var1="$(cat /sys/class/net/*/address | tr -d '\n')"
sec='sec_token2'
eng='eng_token2'
upload='upload_token2'
sec=$var1$sec
sec="$(echo $sec | sha256sum)"
eng=$var1$eng
eng="$(echo $eng | sha256sum)"
upload=$var1$upload
upload="$(echo $upload | sha256sum)"
echo ${sec::-3} > $out_put_file
echo ${eng::-3} >> $out_put_file
echo ${upload::-3} >> $out_put_file
ver_hash="$(sha1sum $out_put_file)"
echo $ver_hash > $out_put_file_ver
chmod -w $out_put_file
chmod -w $out_put_file_ver
reboot
fi
22 changes: 22 additions & 0 deletions recipes-core/srp-recover/srp-recover.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DESCRIPTION = "SRP Initscripts"
LICENSE = "CLOSED"

SRC_URI += "\
file://srp_recover.sh \
"

INITSCRIPT_NAME = "srp_recover.sh"
INITSCRIPT_PARAMS = "start 99 5 ."

inherit update-rc.d

S = "${UNPACKDIR}"

do_install () {
install -d ${D}${sysconfdir}/init.d/
install -c -m 755 ${UNPACKDIR}/${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
}

DEPENDS = "bash"

RDEPENDS:${PN} = "bash"
18 changes: 0 additions & 18 deletions recipes-core/srp-startup/files/srp_start.service

This file was deleted.

46 changes: 0 additions & 46 deletions recipes-core/srp-startup/files/srp_start.sh

This file was deleted.

36 changes: 0 additions & 36 deletions recipes-core/srp-startup/srp-startup.bb

This file was deleted.

72 changes: 72 additions & 0 deletions recipes-core/srp-user/srp-user.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
SUMMARY = "Example recipe for using inherit useradd"
DESCRIPTION = "This recipe serves as an example for using features from useradd.bbclass"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"

SRC_URI = "file://file1 \
file://file2 \
file://file3 \
file://file4"

S = "${UNPACKDIR}"

inherit useradd

PACKAGES =+ "${PN}-user3"

# You must set USERADD_PACKAGES when you inherit useradd. This
# lists which output packages will include the user/group
# creation code.
USERADD_PACKAGES = "${PN} ${PN}-user3"

# You must also set USERADD_PARAM and/or GROUPADD_PARAM when
# you inherit useradd.

# USERADD_PARAM specifies command line options to pass to the
# useradd command. Multiple users can be created by separating
# the commands with a semicolon. Here we'll create two users,
# user1 and user2:

GROUPADD_PARAM:${PN} = "-g 1000 srp ; -g 1001 logs ; -g 1002 persistence ; -g 1003 com ; -g 890 group2;--system gpio;--system i2c;--system tty;--system bin"

# Likewise, we'll manage group3 in the useradd-example-user3 package:
GROUPADD_PARAM:${PN}-user3 = "-g 900 group3"

USERADD_PARAM:${PN} = "-u 1000 -d /home/srpapp -r -s /bin/bash --groups srp,gpio,i2c,tty,bin,logs,persistence,com srpapp"

# user3 will be managed in the useradd-example-user3 package:
# As an example, we use the -p option to set password ('user3') for user3
USERADD_PARAM:${PN}-user3 = "-u 1202 -d /home/user3 -r -s /bin/bash -p '\$6\$XAWr.8nc\$bUE4pYYaVb8n6BbnBitU0zeJMtfhTpFpiOBLL9zRl4e4YQo88UU4r/1kjRzmTimCy.BvDh4xoFwVqcO.pihLa1' user3"


GROUPADD_PARAM:${PN}-user3 = "-g 900 group3"

do_install () {
install -d -m 755 ${D}${datadir}/srpapp
install -d -m 755 ${D}${datadir}/user3
install -p -m 644 ${UNPACKDIR}/file1 ${D}${datadir}/srpapp/

install -p -m 644 ${UNPACKDIR}/file3 ${D}${datadir}/user3/
install -p -m 644 ${UNPACKDIR}/file4 ${D}${datadir}/user3/
install -d ${D}/persistence
install -d ${D}/logs
chmod 0666 ${D}/persistence
chmod 0666 ${D}/logs
}

do_rootfs() {
chgrp -R persistence ${D}/persistence
chgrp -R logs ${D}/logs
chgrp -R com ${D}/run
}

FILES:${PN} = "${datadir}/srpapp/* \
/logs \
/persistence \
"
FILES:${PN}-user3 = "${datadir}/user3/*"

# Prevents do_package failures with:
# debugsources.list: No such file or directory:
# INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

#!/bin/sh
#!/bin/bash
################################################################################
#
# Copyright (c) 2024 Bartosz Snieg.
#
#
################################################################################
#
#
echo "Setting interface: eth0 for ec "
echo "ip: 192.168.10.101"
echo "ip: 192.168.10.52"
echo "net mask 255.255.255.0 "
ifconfig eth0 192.168.10.101 netmask 255.255.255.0
ifconfig eth0 192.168.10.52 netmask 255.255.255.0
echo "Interface set [DONE]"

39 changes: 39 additions & 0 deletions recipes-core/srp/files/srp_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

out_put_file="/srp/token/token.hex"
out_put_file_ver="/srp/token/token.hex.sha1"
Comment on lines +3 to +4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu się ścieżki pewnie nie zgadzaja, a tu wsm wszedzie w skryptach jest zla


if [ ! -d "/srp/update" ]; then
cd /srp
mkdir update
echo "[SRP-PLATFORM]: [INFO] SRP sw dir added"
fi

if [ ! -d "/srp/update/backup" ]; then
cd /srp/update
mkdir backup
echo "[SRP-PLATFORM]: [INFO] Backup dir added"
fi

if [ ! -d "/srp/update/new" ]; then
cd /srp/update
mkdir new
echo "[SRP-PLATFORM]: [INFO] New dir added"
fi

if [ ! -d "/srp/update/current" ]; then
cd /srp/update
mkdir current
echo "[SRP-PLATFORM]: [INFO] Current dir added"
fi

if sha1sum -c $out_put_file_ver;
then
sh /srp/opt/cpu_srp/start_up.sh
else
echo "[SRP-PLATFORM]: [ERROR] Security file breach detected"
echo "[SRP-PLATFORM]: [INFO] Deletion of invalid token"
rm $out_put_file
rm $out_put_file_ver
echo "[SRP-PLATFORM]: [INFO] Reboot the system"
fi
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

#!/bin/sh
#!/bin/bash
################################################################################
#
# Copyright (c) 2024 Bartosz Snieg.
#
################################################################################
#
echo "Simab SRP start up script"
echo "SRP start up script"

sh /opt/cpu_simba/network_interface.sh
sh /opt/cpu_simba/component_start_up.sh
sh /srp/opt/cpu_srp/network_interface.sh

echo "Simab SRP start up script [DONE]"
echo "SRP start up script [DONE]"
3 changes: 3 additions & 0 deletions recipes-core/srp/files/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

f0fe281ebf48da4c8cb23d1cdf5a908c04824b8065fff81f8494730abe4e62b8
3171dc64bae40fd17caab150af3012e4d6f3a560900c56d2c84af211d98870d9
2 changes: 2 additions & 0 deletions recipes-core/srp/files/token.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
f0fe281ebf48da4c8cb23d1cdf5a908c04824b8065fff81f8494730abe4e62b8
3171dc64bae40fd17caab150af3012e4d6f3a560900c56d2c84af211d98870d9
1 change: 1 addition & 0 deletions recipes-core/srp/files/token.hex.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
697c683dab6a72bb16e01ca51b085d34e9a23dff token.hex
1 change: 1 addition & 0 deletions recipes-core/srp/files/token.hex.verified
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading