MycroftOS: Multiple fixes, tweakes, changes and/or reverts.

Basically a bunch of staged stuff of before the upgrade of
buildroot and mycroft. If I remember it all correctly;

- Change the folder permissions setup from device_table to
  systemd.
- Remove the mycroft user setup from the mycroft.service
  package into a systemwide buildroot user_table.txt
- Fix respeaker stuff for systemd system
- Fix sudo system for the mycroft user
- Allow mycroft to SSH into the system. Disallow root login.
- Probably some other fixes and tweaks I forgot about....
This commit is contained in:
Peter Steenbergen 2019-09-09 15:25:51 +02:00
parent 23bb1b70b3
commit 3bbdddfa01
13 changed files with 44 additions and 40 deletions

View File

@ -1,26 +0,0 @@
# See package/makedevs/README for details
#
# This device table is used to assign proper ownership and permissions
# on various files. It doesn't create any device file, as it is used
# in both static device configurations (where /dev/ is static) and in
# dynamic configurations (where devtmpfs, mdev or udev are used).
#
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev d 755 0 0 - - - - -
/tmp d 1777 0 0 - - - - -
/etc d 755 0 0 - - - - -
/root d 700 0 0 - - - - -
/var d 777 0 0 - - - - -
/var/log d 777 0 0 - - - - -
/var/www d 755 33 33 - - - - -
/opt d 777 0 0 - - - - -
/opt/mycroft d 777 0 0 - - - - -
/opt/mycroft/skills d 777 0 0 - - - - -
/etc/shadow f 600 0 0 - - - - -
/etc/passwd f 644 0 0 - - - - -
/etc/network/if-up.d d 755 0 0 - - - - -
/etc/network/if-pre-up.d d 755 0 0 - - - - -
/etc/network/if-down.d d 755 0 0 - - - - -
/etc/network/if-post-down.d d 755 0 0 - - - - -
# uncomment this to allow starting x as non-root
#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - -

View File

@ -12,16 +12,16 @@ BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY=y
BR2_TARGET_GENERIC_HOSTNAME="MycroftOS"
BR2_TARGET_GENERIC_ISSUE="Welcome to MycroftOS"
BR2_INIT_SYSTEMD=y
BR2_ROOTFS_DEVICE_TABLE="../buildroot-external/board/raspberrypi3/device_table.txt"
BR2_TARGET_GENERIC_ROOT_PASSWD="mycroft"
BR2_SYSTEM_BIN_SH_BASH=y
# BR2_TARGET_GENERIC_GETTY is not set
BR2_SYSTEM_DHCP="eth0"
# BR2_ENABLE_LOCALE_PURGE is not set
BR2_GENERATE_LOCALE="en_US.UTF-8"
BR2_ROOTFS_OVERLAY="../buildroot-external/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="../buildroot-external/board/raspberrypi3/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="../buildroot-external/board/raspberrypi3/post-image.sh"
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL)/user_table.txt"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL)/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL)/board/raspberrypi3/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL)/board/raspberrypi3/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
@ -30,7 +30,7 @@ BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7688b39276ff9952df381d79de63b258e73971ce"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2709"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2710-rpi-3-b bcm2710-rpi-3-b-plus bcm2710-rpi-cm3"
BR2_PACKAGE_BUSYBOX_CONFIG="../buildroot-external/busybox.config"
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL)/busybox.config"
BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
@ -203,10 +203,12 @@ BR2_PACKAGE_PYTHON_GPIOZERO=y
BR2_PACKAGE_PYTHON_GTTS=y
BR2_PACKAGE_PYTHON_HUMANHASH3=y
BR2_PACKAGE_PYTHON_INFLECTION=y
BR2_PACKAGE_PYTHON_LAZY=y
BR2_PACKAGE_PYTHON_MSK=y
BR2_PACKAGE_PYTHON_OAUTH2CLIENT=y
BR2_PACKAGE_PYTHON_OLEFILE=y
BR2_PACKAGE_PYTHON_PADATIOUS=y
BR2_PACKAGE_PYTHON_PAKO=y
BR2_PACKAGE_PYTHON_PEP8=y
BR2_PACKAGE_PYTHON_PETACT=y
BR2_PACKAGE_PYTHON_POCKETSPHINX=y

View File

@ -10,10 +10,6 @@ MYCROFT_SERVICE_SITE_METHOD = local
MYCROFT_SERVICE_LICENSE = Apache License 2.0
MYCROFT_SERVICE_LICENSE_FILES = LICENSE
define MYCROFT_SERVICE_USERS
mycroft -1 mycroft -1 * /home/mycroft /bin/sh audio,pulse-access
endef
define MYCROFT_SERVICE_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 $(@D)/start-mycroft.sh $(TARGET_DIR)/usr/bin/
$(INSTALL) -m 0755 $(@D)/stop-mycroft.sh $(TARGET_DIR)/usr/bin/

View File

@ -83,7 +83,7 @@ export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
function init-once() {
fbv -f -d 1 /opt/mycroft/splash/logo.png > /dev/null 2>&1
sudo fbv -f -d 1 /opt/mycroft/splash/logo.png > /dev/null 2>&1
if ($first_time) ; then
echo "Initializing..."
# Check if Mycroft log folders are present and if not

View File

@ -99,7 +99,7 @@ case ${OPT} in
end-process audio
end-process speech
end-process enclosure
fbv -f -d 1 /opt/mycroft/splash/background.png > /dev/null 2>&1
sudo fbv -f -d 1 /opt/mycroft/splash/background.png > /dev/null 2>&1
;;
"bus")
end-process messagebus.service

View File

@ -12,7 +12,7 @@ RESPEAKER_DEPENDENCIES = rpi-firmware rpi-userland dtc
$(eval $(kernel-module))
define RESPEAKER_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 644 $(@D)/seeed-voicecard.service \
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/respeaker/seeed-voicecard.service \
$(TARGET_DIR)/usr/lib/systemd/system/seeed-voicecard.service
mkdir -p $(TARGET_DIR)/etc/systemd/system/sysinit.target.wants
ln -fs ../../../../usr/lib/systemd/system/seeed-voicecard.service \
@ -26,6 +26,8 @@ define RESPEAKER_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0644 $(@D)/*.conf $(TARGET_DIR)/etc/voicecard
$(INSTALL) -D -m 0644 $(@D)/*.state $(TARGET_DIR)/etc/voicecard
$(INSTALL) -D -m 0755 $(@D)/seeed-voicecard $(TARGET_DIR)/usr/bin
$(INSTALL) -D -m 0755 $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/respeaker/start-seeed-voicecard.sh \
$(TARGET_DIR)/usr/bin
$(INSTALL) -D -m 0644 $(@D)/seeed-2mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-4mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/

View File

@ -0,0 +1,12 @@
[Unit]
Description=Seeed Voicecard service
After=alsa-restore.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/start-seeed-voicecard.sh
User=root
[Install]
WantedBy=sysinit.target

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Configure seeed-voicecard....
#
echo "Starting seeed-voicecard..."
mount -t configfs none /sys/kernel/config
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
/usr/bin/seeed-voicecard
touch /var/lock/seeed-voicecard

View File

@ -6,5 +6,6 @@ tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /var/log tmpfs defaults 0 0
tmpfs /var/tmp tmpfs defaults 0 0
tmpfs /ramdisk tmpfs rw,nodev,nosuid,size=20M 0 0

View File

@ -29,10 +29,11 @@
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
AllowUsers *@*
#PubkeyAuthentication yes

View File

@ -94,4 +94,4 @@ root ALL=(ALL) ALL
## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
includedir /etc/sudoers.d
#includedir /etc/sudoers.d

View File

@ -0,0 +1,4 @@
d /var/log/mycroft 700 mycroft mycroft
d /opt/mycroft 755 mycroft mycroft
d /opt/mycroft/skills 755 mycroft mycroft
d /opt/mycroft/splash 755 mycroft mycroft

View File

@ -0,0 +1 @@
mycroft -1 mycroft -1 =mycroft /home/mycroft /bin/sh gpio,audio,pulse,pulse-access Mycroft user