Skip to content

Commit

Permalink
contrib: initialize defualt configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
blocktrron committed Jul 25, 2024
1 parent 8ea6d67 commit a836ca7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
13 changes: 12 additions & 1 deletion openwrt/oob-packages/ffda-oob-firmware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ define Package/ffda-oob-firmware
DEPENDS:=+ffda-oob-state-reporter
endef

define Package/ffda-oob-firmware/conffiles
/lib/ffda-oob-firmware/userdata
/lib/ffda-oob-firmware/configured
endef

define Package/ffda-oob-firmware/config
config FFDA_OOB_FIRMWARE_VERSION
string "Gluon version number"
Expand All @@ -31,10 +36,16 @@ endef
define Package/ffda-oob-firmware/install
$(Gluon/Build/Install)

$(INSTALL_DIR) $(1)/lib/ffda-oob-firmware $(1)/usr/bin
$(INSTALL_DIR) $(1)/lib/ffda-oob-firmware $(1)/lib/ffda-oob-firmware/userdata $(1)/lib/ffda-oob-firmware/conffiles/config $(1)/usr/bin $(1)/etc/uci-defaults

echo '$(call qstrip,$(CONFIG_FFDA_OOB_FIRMWARE_VERSION))' > $(1)/lib/ffda-oob-firmware/firmware-version
touch $(1)/lib/ffda-oob-firmware/userdata/.keep

$(INSTALL_BIN) ./files/ffda-oob-ntp.sh $(1)/usr/bin/ffda-oob-ntp
$(INSTALL_BIN) ./files/uci-defaults.sh $(1)/etc/uci-defaults/99_ffda-oob-firmware

$(CP) ./files/authorized_keys $(1)/lib/ffda-oob-firmware/conffiles/authorized_keys
$(CP) ./files/config/* $(1)/lib/ffda-oob-firmware/conffiles/config/
endef

$(eval $(call BuildPackage,ffda-oob-firmware))
5 changes: 5 additions & 0 deletions openwrt/oob-packages/ffda-oob-firmware/files/authorized_keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDT5g1/AyHrZh9cJ2R2dXRKKrc3YV0DfT4B5QExCH0st magnus@mfruehling-t470 # managed key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDM6d1E1gczThXTfwGLuzbo9t3xUdpp53wi9Ya5IyxUlB0rNO9Nc2mKvI99Pp/4POan6vAj+dyEA9ve5WtYfOKYrwHHKnUsuSxDMORYhnGjuzrjM5hdJvVgtfmGV9ilC419Jy3+nxY2jZ992hCd/IP8i5epIoZIDDJ6QaSAVKIt3YZWpKxzalty5ugBlknkvaX5q7n32qIVx6cxpNAPjXVJ/rk1tzKldXkNCL36HjHZhPCqwzOVpLbjrGfEonFuU1sSR+8UfzlD7JeOSrwUck6MGEGFvCJVG/NqfNTe3tlMfc4bV69U9b4bsLeCVDXNAaxqByZoNrs/7jAmRdBeJBnylhvKdTb/lF3Nhs/Vor4H/ih+XL1suzu0z4lC1MiAuZrgBL+vQmLGpbjaKD1Px7awQuTrQ8Y6Faed76L0a22bzx/+2yN32VJ5if7cjg72gCzffHwZkjU8tnFuNAGGMTz6EQCljFMwJQTjYaxKz+bp559jO2Av5WlWNeasB2qZP8m/IRDTUt7jpcS9EZUWt66dTP6Xt+m2rXlyzREsekGiYp+4Ew41LNmAme+jhHUb9NlvtuxNxD555IzscSjwxVraNhfiaQbh6mGz3HM6fPYe7R7C8An2xo+FW5W2mq9n2OnmUDjx9pGIn24c2ji8oT9m9lqclXI1tbP9Nw5b1aKp8Q== blocktrron_freifunk # managed key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKf8VPiyhiFKqEFHjd4iY86ktiQEXSYRvG/aiLH7ETmk ffda+fw@tomh v2 # managed key
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfwrD05VmFMorcHkXOnJqsEyougYiYAeg82zH8rw52+ aron@enif # managed key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhDBMsueimAS7RlogiUnRWLrfLSPOC6ZecaYJGOe52U/7toVNkOC9G56Q8+vviGWTwdEZO5PK79c4KCBaP+5ohO4IpQ//sc71d9/UcpAp+dLPCJAa9mVQQKCY9WBO1mhzCWqYSxZY5gHLIglUjeeRVrUQhENskka5Smy0aMo7XW4dI6AA71XhcF6ipqSJePmSdCAvhdaJ2e/QkEt5Fx7Gcf3meAwDQov+8lAiXw2igTPhXFfsgyXUiQOBbLzIwNgL9PZeJv5UFYhohjw/ZQ2n+uLuc/PQdvCXC0t2QUJk5I+qkTdwxiHsBYkVYbtFxFVke6eonQoYsYgAMqzjQW+aR alexp # managed key
21 changes: 21 additions & 0 deletions openwrt/oob-packages/ffda-oob-firmware/files/uci-defaults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Always overwrite authorized_keys
cp /lib/ffda-oob-firmware/conffiles/authorized_keys /etc/dropbear/authorized_keys

# Check if /lib/ffda-oob-firmware/configured exists
if [ -f /lib/ffda-oob-firmware/configured ]; then
exit 0
fi

# Copy th default configuration files
cp /lib/ffda-oob-firmware/conffiles/config/* /etc/config/

# ToDo: Randomize host-id for state-reporter

# ToDo: Set hostname to "ffda-oob-<host-id>"

# Mark device as configured
touch /lib/ffda-oob-firmware/configured

exit 0

0 comments on commit a836ca7

Please sign in to comment.