From: Paul Hänsch Date: Sat, 20 Jul 2019 10:08:13 +0000 (+0200) Subject: unified bootloader targets, root key setup, webui mode, modules for live boot (lokfs... X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=92dfcb2f828b2bb5eaa5b127ffa1a4bf15432335;p=blast unified bootloader targets, root key setup, webui mode, modules for live boot (lokfs overlay), config for gimp, syntax readability --- diff --git a/Makefile b/Makefile index 41a9993..36cd2b9 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,11 @@ nul_:= comma_:= , space_:= ${nul_} ${nul_} -.PHONY: clean .FORCE -.PHONY: _config_raspi _partition_raspi -.PHONY: _qemu _bootstrap _install _copy _config_raspi _config _bootloader _squash -.PHONY: _target _partition _format _mount _sparse _umount _partcopy _mbr +.PHONY: clean .FORCE _target +.PHONY: _bootloader_raspi _bootloader_pc _partition_gpt _partition_raspi +.PHONY: _squash_modules +.PHONY: _qemu _bootstrap _install _copy _config _bootloader _squash +.PHONY: _partition _format _mount _sparse _umount _partcopy _mbr ARCH := amd64 KEYRING := keys/debian-archive-stretch-stable.gpg @@ -36,13 +37,13 @@ ifdef disk _target: _mbr _umount _config _install _partition - _partition: + _partition: _partition_gpt _format: _partition _mount: _format _bootstrap: _mount _install: _bootstrap _mount _config: _install _mount - _bootloader: _mount + _bootloader: _mount _bootloader_pc _umount: _mount _config _bootloader _mbr: _umount _bootloader @@ -62,9 +63,9 @@ else ifdef image _mount: _format _copy: _install _mount _config: _copy _mount - _bootloader: _mount + _bootloader: _mount _bootloader_pc _umount: _mount _config _bootloader - _partition: + _partition: _partition_gpt _partcopy: _partition _umount _mbr: _partcopy _bootloader @@ -79,7 +80,7 @@ else ifdef squash _install: _bootstrap _copy: _install _config: _copy - _squash: _config + _squash: _config _squash_modules else ifdef raspi VOLUME := ${raspi} @@ -108,11 +109,11 @@ PACKAGES := ${PACKAGES} firmware-brcm80211 libraspberrypi-bin libraspberrypi0 pi _format: _sparse _mount: _format _copy: _install _mount - _config_raspi: _copy _mount - _config: _copy _mount _config_raspi - _umount: _mount _config - _partition_raspi: - _partcopy: _partition_raspi _umount + _config: _copy _mount + _bootloader: _mount _bootloader_raspi + _umount: _mount _config _bootloader + _partition: _partition_raspi + _partcopy: _partition _umount else _target: @@ -192,10 +193,6 @@ _install: ${SYSROOT} _aptkeys _norecommends _copy: ${SYSROOT} ${CFGROOT} cp -au "$${SYSROOT}/." "$${CFGROOT}/" -_config_raspi: ${CFGROOT}/boot/cmdline.txt -${CFGROOT}/boot/cmdline.txt: ${CFGROOT} - printf 'dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet' >"$@" - .PHONY: _common_config _config: _common_config _common_config: ${CFGROOT} @@ -207,7 +204,10 @@ ${SQUASH}: ${CFGROOT} -rm "$${SQUASH}" mksquashfs "$${CFGROOT}" "$${SQUASH}" -comp xz -_squash: ${SQUASH} +_squash_modules: ${CFGROOT} + printf '%s\n' squashfs nbd >>"${CFGROOT}/etc/initramfs-tools/modules" + +_squash: ${SQUASH} _squash_modules ${VOLUME}: .FORCE ! printf '%s\n' "$${VOLUME}" |grep -q '^/dev/' # abort if volume should be real device @@ -229,7 +229,7 @@ _partition_raspi: ${VOLUME} printf 'label: dos\n\n: start=2MiB, size=%iMiB, type=c\n: start=%iMiB, size=%iMiB, type=83\n' \ ${BOOT_MB} "$$((${BOOT_MB} + 2))" ${ROOT_MB} | sfdisk "$${VOLUME}" -_partition: ${VOLUME} +_partition_gpt: ${VOLUME} printf 'label: gpt\n\n: start=2MiB, size=%iMiB, type=1, attrs="LegacyBIOSBootable"\n: size=%iMiB, type=20\n' \ ${BOOT_MB} ${ROOT_MB} | sfdisk "$${VOLUME}" @@ -272,7 +272,12 @@ _grub_efi64: ${CFGROOT} mkdir -p "$${CFGROOT}/boot/EFI/BOOT" grub-mkimage -p / -O x86_64-efi fat part_gpt normal linux all_video >"$${CFGROOT}/boot/EFI/BOOT/BOOTX64.EFI" -_bootloader: ${CFGROOT} _grub_efi32 _grub_efi64 _syslinux_bios #_syslinux_efi32 _syslinux_efi64 +${CFGROOT}/boot/cmdline.txt: ${CFGROOT} + printf 'dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet' >"$@" + +_bootloader_raspi: ${CFGROOT} ${CFGROOT}/boot/cmdline.txt + +_bootloader_pc: ${CFGROOT} _grub_efi32 _grub_efi64 _syslinux_bios #_syslinux_efi32 _syslinux_efi64 printf 'UI menu.c32\nDEFAULT stretch\nTIMEOUT 30\n' >"$${CFGROOT}/boot/bootmenu.cfg" printf 'set timeout=3\ndefault=stretch\n\n' >"$${CFGROOT}/boot/grub.cfg" k="$$(printf ' %s' "$${CFGROOT}/boot/"vmlinuz-*)"; k="$${k##*/}"; \ diff --git a/config.example b/config.example index d7c6688..1014f18 100644 --- a/config.example +++ b/config.example @@ -18,8 +18,14 @@ ## Root password will be salted and encrypted in image # rootpass=topsecret +## The corresponding .pub file for the given rootkey will be applied as +## SSH login file for the root user. +## If the pub file is not found, a new key pair will be generated +# rootkey=image_ssh + ## Comma separated list of users to be set up. ## User logins will start out with an empty password +## If the live module is in use, users will also be added to the sudo group # users=adam,steve ## Wifi configuration, if a Wifi password is given, WPA encryption will be used @@ -37,6 +43,9 @@ ## If no user is given here, then nodm will default to root # nodm_user=adam +## In nodm, use full screen chromium web browser as session +# webui=http://localhost/ + ## If the approxmodule is enabled, then one (and only one) apt-source ## can be choosen to install packages from ## See modules/approx.mk if you need more flexibility diff --git a/modules/approx.mk b/modules/approx.mk index c8ed445..ca3f34a 100644 --- a/modules/approx.mk +++ b/modules/approx.mk @@ -11,20 +11,16 @@ deb ${approx} stretch main endef else ifdef raspi - -BOOTSTRAP := http://localhost/raspbian -define SOURCES = -deb http://localhost/raspbian stretch main non-free firmware rpi -deb http://localhost/rpidebian stretch main -endef - + BOOTSTRAP := http://localhost/raspbian + define SOURCES := + deb http://localhost/raspbian stretch main non-free firmware rpi + deb http://localhost/rpidebian stretch main + endef else - -BOOTSTRAP := http://localhost/debian -define SOURCES = -deb http://localhost/debian stretch main -endef - + BOOTSTRAP := http://localhost/debian + define SOURCES := + deb http://localhost/debian stretch main + endef endif .PHONY: _approx_restore_sources diff --git a/modules/default.mk b/modules/default.mk index 47f958b..2f5364b 100644 --- a/modules/default.mk +++ b/modules/default.mk @@ -13,6 +13,7 @@ export DEBCONF define DEBCONF := keyboard-configuration keyboard-configuration/model select Generic 105-key (Intl) PC keyboard-configuration keyboard-configuration/variant select English (US) - English (Macintosh) + endef .PHONY: _debconf_selections @@ -51,6 +52,11 @@ ifdef rootpass _config: _rootpass endif +ifdef rootkey + export rootkey + _config: _rootkey +endif + ifdef users _config: _users endif @@ -63,6 +69,13 @@ endif _rootpass: ${CFGROOT} chroot "$${CFGROOT}" usermod -p "$$(openssl passwd "$${rootpass}")" root +${rootkey}.pub: + ssh-keygen -N '' -f "$${rootkey}" + +_rootkey: ${CFGROOT} ${rootkey}.pub + mkdir -m 700 "$${CFGROOT}/root/.ssh/" + cp "$${rootkey}.pub" "$${CFGROOT}/root/.ssh/authorized_keys" + _users: ${CFGROOT} for u in $(subst ${comma_},${space_},${users}); do \ chroot "$${CFGROOT}" useradd -m -s /bin/bash -p "$$(openssl passwd "")" "$$u"; \ diff --git a/modules/display_ws5inch.mk b/modules/display_ws5inch.mk index d948c5d..49b27b7 100644 --- a/modules/display_ws5inch.mk +++ b/modules/display_ws5inch.mk @@ -1,4 +1,4 @@ -define display_ws5inch_boot = +define display_ws5inch_boot := # Waveshare 5 Inch Display hdmi_group=2 @@ -11,7 +11,7 @@ enable_uart=1 dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900 endef -define display_ws5inch_cfg = +define display_ws5inch_cfg := Section "InputClass" Identifier "evdev touchscreen catchall" MatchIsTouchscreen "on" @@ -23,7 +23,7 @@ endef export display_ws5inch_boot display_ws5inch_cfg -PACKAGES := ${PACKAGES} xserver-xorg-input-evdev xinput xinput-calibrator +PACKAGES += xserver-xorg-input-evdev xinput xinput-calibrator .PHONY: _display_ws5inch _config: _display_ws5inch @@ -31,4 +31,3 @@ _display_ws5inch: ${CFGROOT} _copy _mount printf %s "$${display_ws5inch_boot}" >>"$${CFGROOT}/boot/config.txt" mkdir -p "$${CFGROOT}/usr/share/X11/xorg.conf.d/" printf %s "$${display_ws5inch_cfg}" >"$${CFGROOT}/usr/share/X11/xorg.conf.d/45-evdev.conf" - #-chroot "$${CFGROOT}" adduser local input diff --git a/modules/gimp.mk b/modules/gimp.mk new file mode 100644 index 0000000..84b5476 --- /dev/null +++ b/modules/gimp.mk @@ -0,0 +1,6 @@ +PACKAGES += gimp gimp-data-extras + +.PHONY: _gimp +_config: _gimp +_gimp: ${CFGROOT} modules/gimp/ + cp -a modules/gimp/. "$${CFGROOT}" diff --git a/modules/gimp/etc/gimp/2.0/controllerrc b/modules/gimp/etc/gimp/2.0/controllerrc new file mode 100644 index 0000000..def2ad2 --- /dev/null +++ b/modules/gimp/etc/gimp/2.0/controllerrc @@ -0,0 +1,40 @@ +# GIMP controllerrc +# +# This file will be entirely rewritten each time you exit. + +(GimpControllerInfo "Main Mouse Wheel" + (stock-id "gimp-controller-wheel") + (enabled yes) + (debug-events no) + (controller "GimpControllerWheel") + (mapping + (map "scroll-down-shift-control-alt" "context-font-select-previous") + (map "scroll-up-shift-control-alt" "context-font-select-next") + (map "scroll-down-alt" "tools-value-1-decrease-skip") + (map "scroll-up-control-alt" "context-gradient-select-next") + (map "scroll-down-shift-control" "context-brush-select-previous") + (map "scroll-up-alt" "tools-value-1-increase-skip") + (map "scroll-up-shift-alt" "context-pattern-select-next") + (map "scroll-down-shift-alt" "context-pattern-select-previous") + (map "scroll-up-shift-control" "context-brush-select-next") + (map "scroll-down-control-alt" "context-gradient-select-previous"))) +(GimpControllerInfo "Main Keyboard" + (stock-id "gimp-controller-keyboard") + (enabled yes) + (debug-events no) + (controller "GimpControllerKeyboard") + (mapping + (map "cursor-left-alt" "tools-value-1-decrease") + (map "cursor-right-shift" "view-scroll-page-right") + (map "cursor-left-shift" "view-scroll-page-left") + (map "cursor-up-control" "view-scroll-top-border") + (map "cursor-right-alt" "tools-value-1-increase") + (map "cursor-right-control" "view-scroll-right-border") + (map "cursor-left-control" "view-scroll-left-border") + (map "cursor-down-control" "view-scroll-bottom-border") + (map "cursor-up-shift" "view-scroll-page-up") + (map "cursor-up-alt" "tools-value-1-increase-skip") + (map "cursor-down-shift" "view-scroll-page-down") + (map "cursor-down-alt" "tools-value-1-decrease-skip"))) + +# end of controllerrc diff --git a/modules/gimp/etc/gimp/2.0/gimprc b/modules/gimp/etc/gimp/2.0/gimprc new file mode 100644 index 0000000..8169fbc --- /dev/null +++ b/modules/gimp/etc/gimp/2.0/gimprc @@ -0,0 +1,11 @@ +# GIMP gimprc +# +# This is your personal gimprc file. Any variable defined in this file takes +# precedence over the value defined in the system-wide gimprc: +# /etc/gimp/2.0/gimprc +# Most values can be set within GIMP by changing some options in the +# Preferences dialog. + + + +# end of gimprc diff --git a/modules/gimp/etc/gimp/2.0/gtkrc b/modules/gimp/etc/gimp/2.0/gtkrc new file mode 100644 index 0000000..f4efa07 --- /dev/null +++ b/modules/gimp/etc/gimp/2.0/gtkrc @@ -0,0 +1,24 @@ +# pixmap_path ":::..." +# +# include "rc-file" +# +# style [= ] +# { +#