From b7179a34733da929d9f29aec01cddbf84859405c Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 14:27:42 +0700 Subject: [PATCH 01/45] WPA Supplicant which should replace iotwifi functionality --- etc/init.d/{wpa_supplicant.alt => wpa_supplicant} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename etc/init.d/{wpa_supplicant.alt => wpa_supplicant} (100%) diff --git a/etc/init.d/wpa_supplicant.alt b/etc/init.d/wpa_supplicant similarity index 100% rename from etc/init.d/wpa_supplicant.alt rename to etc/init.d/wpa_supplicant From d520e98edce6bc2510899695c6bba0f34533fb0c Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:55:18 +0700 Subject: [PATCH 02/45] Aarch64 in etc/apk --- etc/apk/arch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/apk/arch b/etc/apk/arch index 07f16e76..96477429 100644 --- a/etc/apk/arch +++ b/etc/apk/arch @@ -1 +1 @@ -armhf +aarch64 From ab04cc9e9c066b181579a30e5bfc2ce996826b00 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:55:27 +0700 Subject: [PATCH 03/45] Update motd --- etc/motd | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/etc/motd b/etc/motd index 210c5f20..03341e76 100644 --- a/etc/motd +++ b/etc/motd @@ -1,6 +1,20 @@ -Welcome! +Welcome to LNCM Box! -This LNCM-Box v0.4.1 runs Alpine Linux 3.8.2 +MMMNOl,. .... .',...... .'cxXWMM +MXd, .. .lOOl. .. 'oKW +x' '. .lOOc .. .o + .. 'lo, .. +. .,. .. .,. . +o. .. .. l +No'. .. .... .. .oX +MWX0xl' . .. .cdOXWM +MMMMMWKd,. ':;. ... .;l; 'l0WMMMMM +MMMMMMMMN0xdoxKKo. .lKXOoox0NMMMMMMMM +MMMMMMMMMMMMXKWMO' . .kMWXXWMMMMMMMMMMM +MMMMMMMMMMMMMMMMX: . ,0MMWXKNMMMMMMMMMM +MMMMMMMMMMMMMMMMWd. . :XMMK:;0MMMMMMMMMM +MMMMMMMMMMMMMMMMM0, cNMNl.cXMMMMMMMMMM +MMMMMMMMMMMMMMMMMWx. ,oo;.lXMMMMMMMMMMM +MMMMMMMMMMMMMMMMMMNx:,. .dNMMMMMMMMMMMM -Open README.md for help, e.g. type: -more README.md [ENTER] (q to quit) +For more info, please check out https://lncm.io/ From 4c14e494dc1b3ad5fe73bf56786ae44d17a12b34 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:55:42 +0700 Subject: [PATCH 04/45] Update installed packages --- etc/apk/world | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/apk/world b/etc/apk/world index 5ae30545..2830ccb3 100644 --- a/etc/apk/world +++ b/etc/apk/world @@ -2,6 +2,10 @@ alpine-base avahi dbus docker +chrony +openssl openssh wireless-tools wpa_supplicant +e2fsprogs +parted From f2117c426c56e4ff80fd8862edb329dc81cf54ec Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:55:57 +0700 Subject: [PATCH 05/45] Update scripts when run --- etc/init.d/lncm | 4 ++-- etc/init.d/lncm-online | 8 ++++++-- etc/init.d/lncm-post | 30 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/etc/init.d/lncm b/etc/init.d/lncm index be4b4adc..9a5d28cd 100755 --- a/etc/init.d/lncm +++ b/etc/init.d/lncm @@ -12,7 +12,7 @@ start() { # This script will only run once, for persistent installation to SD # LNCM version - VER="v0.4.1" + VER="v0.5.0" # apkovl APK=box.apkovl.tar.gz @@ -190,7 +190,7 @@ start() { setup_user install_boot mark_sd - #create_swap # disable sd card swap + create_swap enable_post disable_install persist_state diff --git a/etc/init.d/lncm-online b/etc/init.d/lncm-online index f0be74fb..a267abe5 100755 --- a/etc/init.d/lncm-online +++ b/etc/init.d/lncm-online @@ -18,17 +18,21 @@ start() { } ONLINE=1 + COUNT=0 - while [ $ONLINE -eq 1 ] + while [ $ONLINE -eq 1 ] && [ $COUNT -lt 10 ] do - echo "Checking for internet connection..." + echo "Checking for internet connection for 10 seconds..." net_check + COUNT=$((count + 1)) sleep 1 done if [ $ONLINE -eq 0 ]; then echo "Connected to internet" exit 0 + else + echo "Not connected to internet after 30 seconds" fi eend $? diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 1ac9c3f6..b2acdc23 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -291,28 +291,28 @@ start() { fi move_cache - install_compose - install_toml - install_noma - usb_setup - verify_usb + #install_compose + #install_toml + #install_noma + #usb_setup + #verify_usb # Fetch invoicer into path - fetch_invoicerconfig - fetch_rpcauth - check_rpc + #fetch_invoicerconfig + #fetch_rpcauth + #check_rpc # Configure invoicer, and services stage - generate_rpc + #generate_rpc install_tor enable_tor setup_tor # Copy into path - config_bitcoind - config_lnd - config_nginx - fetch_invoicerui - install_crontab + #config_bitcoind + #config_lnd + #config_nginx + #fetch_invoicerui + #install_crontab disable_post - enable_compose + #enable_compose persist_state } From 5832650fb9df23741c171c76bb2181775e8c7c3c Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:56:26 +0700 Subject: [PATCH 06/45] Update make_img --- make_img.sh | 62 ++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/make_img.sh b/make_img.sh index dd6e758a..f58baa25 100755 --- a/make_img.sh +++ b/make_img.sh @@ -4,15 +4,19 @@ # 256MB bootable FAT32L partition with official Alpine linux and lncm-box # Make sure "parted", "dosfstools" and "zip" are installed -OUTPUT_VERSION=v0.4.1 +# For Outputing an image +OUTPUT_VERSION=v0.5.0 +# For Libraries DOWNLOAD_VERSION=v0.4.1 -ALP=alpine-rpi-3.8.2-armhf.tar.gz -REL=v3.8 + +# For fetching Alpine +ALP=alpine-rpi-3.10.2-aarch64.tar.gz +ARCH=aarch64 +# Which alpine release directory +REL=v3.10 + IMG=lncm-box-${OUTPUT_VERSION}.img -IOT=iotwifi.tar.gz -NGINX=nginx.tar.gz -FIX=modloop-rpi2.tar.gz -CACHE=cache.tar.gz +CACHE=cache-3.10-aarch64.tar.gz MNT=/mnt/lncm if [ "$(id -u)" -ne "0" ]; then @@ -81,16 +85,6 @@ if [ -f ./etc/wpa_supplicant/wpa_supplicant.conf.bak ]; then rm ./etc/wpa_supplicant/wpa_supplicant.conf.bak fi -fetch_wifi() { - echo "Checking for wifi manager" - mkdir -p home/lncm/public_html/wifi - if [ ! -f home/lncm/public_html/wifi/index.html ]; then - echo "Fetch wifi manager" - wget -O home/lncm/public_html/wifi/index.html --no-verbose \ - https://raw.githubusercontent.com/lncm/iotwifi-ui/master/dist/index.html || exit - fi -} - # Cleanup authorized_keys if [ -d ./home/lncm/.ssh ]; then echo "Remove .ssh directory" @@ -114,27 +108,12 @@ cd lncm-workdir || exit if ! [ -f ${ALP} ]; then echo "${ALP} not found, fetching..." - wget --no-verbose http://dl-cdn.alpinelinux.org/alpine/${REL}/releases/armhf/${ALP} -fi - -if ! [ -f ${IOT} ]; then - echo "${IOT} not found, fetching..." - wget --no-verbose https://github.com/lncm/pi-factory/releases/download/${DOWNLOAD_VERSION}/${IOT} -fi - -if ! [ -f ${FIX} ]; then - echo "${FIX} not found, fetching..." - wget --no-verbose https://github.com/lncm/pi-factory/releases/download/${DOWNLOAD_VERSION}/${FIX} + wget --no-verbose http://dl-cdn.alpinelinux.org/alpine/${REL}/releases/${ARCH}/${ALP} || echo "Error fetching alpine" fi if ! [ -f ${CACHE} ]; then echo "${CACHE} not found, fetching..." - wget --no-verbose https://github.com/lncm/pi-factory/releases/download/${DOWNLOAD_VERSION}/${CACHE} -fi - -if ! [ -f ${NGINX} ]; then - echo "${NGINX} not found, fetching..." - wget --no-verbose https://github.com/lncm/pi-factory/releases/download/${DOWNLOAD_VERSION}/${NGINX} + wget --no-verbose https://gitlab.com/nolim1t/aarch64-alpine-apkvol/raw/834fa018f8ea518f6dee60ffd2967fc5d4b36ec0/${CACHE} || echo "Error fetching cache" fi echo "Create and mount 256MB image" @@ -153,22 +132,13 @@ echo "Mount FAT partition" mount "${DEV}"p1 "${MNT}" echo "Extract alpine distribution" -tar -xzf ${ALP} -C ${MNT}/ --no-same-owner - -echo "Extract iotwifi container" -tar -xzf ${IOT} -C ${MNT}/ --no-same-owner - -echo "Extract nginx container" -tar -xzf ${NGINX} -C ${MNT}/ --no-same-owner +tar -xzf ${ALP} -C ${MNT}/ --no-same-owner || echo "Can't extract alpine" echo "Extract cache dir for docker and avahi" -tar -xzf ${CACHE} -C ${MNT}/ --no-same-owner - -echo "Patch RPi3 WiFi" -tar -xzf ${FIX} -C ${MNT}/boot/ --no-same-owner +tar -xzf ${CACHE} -C ${MNT}/ --no-same-owner || echo "Can't extract cache" echo "Copy latest box.apkovl tarball" -cp ../box.apkovl.tar.gz ${MNT} +cp ../box.apkovl.tar.gz ${MNT} || echo "Can't extract alpine box" echo "Flush writes to disk" sync From 729475221d03c46a4a80069b00914ba21ab54c4b Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 16:57:32 +0700 Subject: [PATCH 07/45] Update lncm-online --- etc/init.d/lncm-online | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/init.d/lncm-online b/etc/init.d/lncm-online index a267abe5..8b789e7b 100755 --- a/etc/init.d/lncm-online +++ b/etc/init.d/lncm-online @@ -20,7 +20,7 @@ start() { ONLINE=1 COUNT=0 - while [ $ONLINE -eq 1 ] && [ $COUNT -lt 10 ] + while [ $ONLINE -eq 1 ] || [ $COUNT -lt 10 ] do echo "Checking for internet connection for 10 seconds..." net_check From 04053e8e9a17d39470082a291984d2aec39bbe74 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 17:56:03 +0700 Subject: [PATCH 08/45] ETC group --- etc/group | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/group b/etc/group index 90f40cef..5390dc8b 100644 --- a/etc/group +++ b/etc/group @@ -48,5 +48,6 @@ nogroup:x:65533: nobody:x:65534: avahi:x:86:avahi messagebus:x:101:messagebus -docker:x:102: +docker:x:102:lncm lncm:x:1001: +chrony:x:101:chrony From 2896c645ae2066bfeff291d1121a6063d7744eb7 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 17:59:59 +0700 Subject: [PATCH 09/45] Protected paths --- etc/apk/protected_paths.d/lbu.list | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/etc/apk/protected_paths.d/lbu.list b/etc/apk/protected_paths.d/lbu.list index 00fc83de..9dcd9cfb 100644 --- a/etc/apk/protected_paths.d/lbu.list +++ b/etc/apk/protected_paths.d/lbu.list @@ -1,14 +1,14 @@ -+etc/tor/torrc ++etc/motd +etc/init.d/lncm +etc/init.d/lncm-post +etc/init.d/lncm-online +etc/init.d/docker-compose -+etc/init.d/iotwifi ++etc/tor/torrc +etc/init.d/avahi-daemon -+etc/init.d/portainer ++etc/init.d/wpa_supplicant ++etc/init.d/noma +etc/init.d/sshd -+etc/init.d/nginx -+etc/init.d/wpa_supplicant.alt ++etc/init.d/wpa_supplicant +home/lncm/bitcoin +home/lncm/litecoin +home/lncm/lnd @@ -21,15 +21,8 @@ +home/lncm/public_html/wifi/index.html +home/lncm/nginx +home/lncm/nginx/conf.d -+home/lncm/.ssh/authorized_keys -+home/lncm/save_password -+home/lncm/seed.txt ++home/lncm/.ssh/authorized_key ++etc/ssh/sshd_config ++usr/local/bin/setup-disk.sh +usr/local/sbin -+usr/local/sbin/mana -+usr/local/sbin/lncm-usb -+usr/local/sbin/lncm-usb.py -+usr/local/sbin/lncm-unlock.py -+usr/local/sbin/check-invoicer-status -+usr/local/sbin/lncm-createwallet.py -+usr/local/sbin/lncm-istorprivkeycreated.py -+usr/local/sbin/lncm-configinvoicer.py ++usr/local/sbin/lncm-getinfo.py From e593457f18637ac8bb1a5c8fb8fed0adaf1cd26b Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:00:37 +0700 Subject: [PATCH 10/45] Simplified tor config --- etc/tor/torrc | 45 +------------------------ etc/wpa_supplicant/wpa_supplicant.conf | 9 ++--- etc/zoneinfo/Asia/Bangkok | Bin 0 -> 211 bytes etc/zoneinfo/UTC | Bin 127 -> 118 bytes 4 files changed, 3 insertions(+), 51 deletions(-) create mode 100644 etc/zoneinfo/Asia/Bangkok diff --git a/etc/tor/torrc b/etc/tor/torrc index 765a0b48..20859b68 100644 --- a/etc/tor/torrc +++ b/etc/tor/torrc @@ -1,50 +1,7 @@ -SOCKSPort 0.0.0.0:9050 # Bind to all interfaces - +SOCKSPort 9050 Log notice file /var/log/tor/notices.log -Log notice syslog #Log debug file /var/log/tor/debug.log -#Log debug syslog - DataDirectory /var/lib/tor ControlPort 9051 -CookieAuthentication 1 - -## If you enable the controlport, be sure to enable one of these -## authentication methods, to prevent attackers from accessing it. -# TODO: generate the password too -#ControlPort 9051 #HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C #CookieAuthentication 1 - -### sshd - -# sshd (tor v3) -HiddenServiceDir /var/lib/tor/ssh-v3/ -HiddenServiceVersion 3 -HiddenServicePort 22 127.0.0.1:22 - -# sshd (tor v2) -HiddenServiceDir /var/lib/tor/ssh-v2/ -HiddenServicePort 22 127.0.0.1:22 - - -### lnd - -# lnd (tor v3) -HiddenServiceDir /var/lib/tor/lnd-v3/ -HiddenServiceVersion 3 -HiddenServicePort 9735 127.0.0.1:9735 - -# lnd (tor v2) -HiddenServiceDir /var/lib/tor/lnd-v2/ -HiddenServicePort 9735 127.0.0.1:9735 - -# lnd rpc (tor v3) -HiddenServiceDir /var/lib/tor/lnd-rpc-v3/ -HiddenServiceVersion 3 -HiddenServicePort 10009 127.0.0.1:10009 - -# lnd rpc (tor v2) -# For controlling the lnd node service -HiddenServiceDir /var/lib/tor/lnd-rpc-v2/ -HiddenServicePort 10009 127.0.0.1:10009 diff --git a/etc/wpa_supplicant/wpa_supplicant.conf b/etc/wpa_supplicant/wpa_supplicant.conf index 9f54fff4..abbbc18d 100644 --- a/etc/wpa_supplicant/wpa_supplicant.conf +++ b/etc/wpa_supplicant/wpa_supplicant.conf @@ -1,10 +1,5 @@ -# Please change to match your country code -country=US -update_config=1 -ctrl_interface=/var/run/wpa_supplicant - network={ - ssid="YOUR WIFI NAME HERE" + ssid="YOUR_SSID_HERE" key_mgmt=WPA-PSK - psk="YOUR WIFI PASSWORD HERE" + psk="YOUR_PSK_HERE" } diff --git a/etc/zoneinfo/Asia/Bangkok b/etc/zoneinfo/Asia/Bangkok new file mode 100644 index 0000000000000000000000000000000000000000..7249640294cd596c9445ce175455efa06b5dc6c3 GIT binary patch literal 211 zcmWHE%1kq2zyQoZ5fBCe7@Ma7$XS$?ex&~Y|No3kObiThHXwN*$-=;pRKURD;~T=@ r1jO0~<{$|m2qD3EpsD}EwzVDs(I9I;`s;ygBCX=G0a|OPYt97#+X*B% literal 0 HcmV?d00001 diff --git a/etc/zoneinfo/UTC b/etc/zoneinfo/UTC index c3b97f1a199421d6d9625b280316d99b85a4a4e8..5583f5b0c6e6949372648a7d75502e4d01b44931 100644 GIT binary patch delta 14 Vcmb;~n-D!wS(J?{G{o6}3jia=1KOV From 6570c4903dec848c2b4cd2bc2e0dcd7965a9f1ee Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:00:57 +0700 Subject: [PATCH 11/45] Usr local bin --- usr/local/bin/setup-disk.sh | 93 +++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 usr/local/bin/setup-disk.sh diff --git a/usr/local/bin/setup-disk.sh b/usr/local/bin/setup-disk.sh new file mode 100755 index 00000000..0993ea15 --- /dev/null +++ b/usr/local/bin/setup-disk.sh @@ -0,0 +1,93 @@ +#!/bin/ash + +setup_disk() { + echo "Initializing EXT4 partition" + /sbin/mkfs.ext4 -F /dev/mmcblk0p2 + echo "Mounting EXT4" + /bin/echo "/dev/mmcblk0p2 /mnt ext4 noatime 0 0" >> /etc/fstab + /bin/mount /mnt +} + +create_swap() { + echo "Create and install swap file" + /bin/dd if=/dev/zero of=/mnt/var/cache/swap bs=1M count=1024 + /bin/chown 600 /mnt/var/cache/swap + /sbin/mkswap /mnt/var/cache/swap + /sbin/swapon /mnt/var/cache/swap + echo "Add swap to disk FSTAB" + /bin/echo "/var/cache/swap none swap sw,pri=10 0 0" >> /mnt/etc/fstab + echo "Enable swap at boot for drive" + cd /mnt/etc/runlevels/boot || exit + /bin/ln -s /etc/init.d/swap swap +} + +clean_devs() { + echo "Remove unused devices and mountpoints" + /bin/sed -i '/cdrom/d' /mnt/etc/fstab + /bin/rmdir /mnt/media/cdrom + /bin/sed -i '/usbdisk/d' /mnt/etc/fstab + /bin/rmdir /mnt/media/usb + /bin/rmdir /mnt/media/floppy +} + +partition_sd() { + if [[ ! -e /dev/mmcblk0p2 ]]; then + echo "Partition doesn't exist, lets set it up" + /usr/sbin/parted -s /dev/mmcblk0 mkpart p ext4 268M 100% + else + echo "Partition already exists!" + fi +} + +install_ext4() { + /sbin/setup-disk -o /media/mmcblk0p1/box.apkovl.tar.gz /mnt || exit 1 + if [ ! -d /mnt/etc ]; then + echo "Setup disk did not seem to create anything! Exiting" + exit 1 + fi +} + +setup_fat_fstab_ext4() { + echo "Add FAT partition to new fstab" + /bin/echo "/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0" >> /mnt/etc/fstab +} + +check_mounted() { + echo "Check if ext4 partition on SD is mounted" + if [ ! -d /mnt/lost+found ]; then + echo "Error: EXT4 partition doesn't seem to be mounted" + exit 1 + fi +} + +copy_wpa_supplicant() { + echo "Copying network information to new mount" + /bin/cp /etc/wpa_supplicant/wpa_supplicant.conf /mnt/etc/wpa_supplicant/wpa_supplicant.conf +} + +setup_boot() { + echo "Re-mount FAT partition read/write" + /bin/mount -o remount,rw /dev/mmcblk0p1 /media/mmcblk0p1 + echo "Backup cmdline" + /bin/cp /media/mmcblk0p1/cmdline.txt /media/mmcblk0p1/cmdline.txt.bak + echo "Prepend root partition to boot command" + /bin/sed -e 's/^/root=\/dev\/mmcblk0p2 /' -i /media/mmcblk0p1/cmdline.txt + echo "Remount FAT as read only" + /bin/mount -o remount,ro /dev/mmcblk0p1 /media/mmcblk0p1 +} + +unmount_ext4_partition() { + umount /mnt +} + +# Steps +partition_sd +setup_disk +check_mounted +install_ext4 # setup file system +create_swap # setup swap +setup_fat_fstab_ext4 # Setup fstab for fat mount +copy_wpa_supplicant # Setup networking +clean_devs # Cleanup drives +setup_boot # Adjust fstab in main SD card + From edf92df143d29374fa59b3a692768ab3f8504ce5 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:01:35 +0700 Subject: [PATCH 12/45] Add docker stuff: --- etc/runlevels/boot/wpa_supplicant | 1 + etc/runlevels/default/chronyd | 1 + etc/runlevels/default/docker | 1 + 3 files changed, 3 insertions(+) create mode 120000 etc/runlevels/boot/wpa_supplicant create mode 120000 etc/runlevels/default/chronyd create mode 120000 etc/runlevels/default/docker diff --git a/etc/runlevels/boot/wpa_supplicant b/etc/runlevels/boot/wpa_supplicant new file mode 120000 index 00000000..da25b62f --- /dev/null +++ b/etc/runlevels/boot/wpa_supplicant @@ -0,0 +1 @@ +/etc/init.d/wpa_supplicant \ No newline at end of file diff --git a/etc/runlevels/default/chronyd b/etc/runlevels/default/chronyd new file mode 120000 index 00000000..a11ae079 --- /dev/null +++ b/etc/runlevels/default/chronyd @@ -0,0 +1 @@ +/etc/init.d/chronyd \ No newline at end of file diff --git a/etc/runlevels/default/docker b/etc/runlevels/default/docker new file mode 120000 index 00000000..34505c7a --- /dev/null +++ b/etc/runlevels/default/docker @@ -0,0 +1 @@ +/etc/init.d/docker \ No newline at end of file From ac44be482c4882c1d125cbe6135efa0b01fd7377 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:01:56 +0700 Subject: [PATCH 13/45] Add stuff to be installed --- etc/apk/world | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/apk/world b/etc/apk/world index 2830ccb3..3d0b784a 100644 --- a/etc/apk/world +++ b/etc/apk/world @@ -1,10 +1,10 @@ alpine-base -avahi dbus -docker +avahi chrony -openssl +docker openssh +openssl wireless-tools wpa_supplicant e2fsprogs From 78b75bf1fc6bea9bd9af2d57682028099089a1d3 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:02:37 +0700 Subject: [PATCH 14/45] Repositories for 3.10 --- etc/apk/repositories | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/etc/apk/repositories b/etc/apk/repositories index d041d70b..309bdc6b 100644 --- a/etc/apk/repositories +++ b/etc/apk/repositories @@ -1,11 +1,7 @@ /media/mmcblk0p1/apks -http://mirror.rise.ph/alpine-linux/v3.8/main -http://mirror.rise.ph/alpine-linux/v3.8/community -http://mirror.xtom.com.hk/alpine/v3.8/main -http://mirror.xtom.com.hk/alpine/v3.8/community -#http://dl-3.alpinelinux.org/alpine/v3.8/main -#http://dl-3.alpinelinux.org/alpine/v3.8/community -#http://dl-5.alpinelinux.org/alpine/v3.8/main -#http://dl-5.alpinelinux.org/alpine/v3.8/community -#http://dl-8.alpinelinux.org/alpine/v3.8/main -#http://dl-8.alpinelinux.org/alpine/v3.8/community \ No newline at end of file +http://mirror.xtom.com.hk/alpine/v3.10/main +http://mirror.xtom.com.hk/alpine/v3.10/community +#http://mirror.xtom.com.hk/alpine/edge/main +#http://mirror.xtom.com.hk/alpine/edge/community +#http://mirror.xtom.com.hk/alpine/edge/testing + From f9f265bcb571e09174b5414ae6c8f6865e615b0a Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:02:52 +0700 Subject: [PATCH 15/45] Keymap --- etc/keymap/us.bmap.gz | Bin 1263 -> 1263 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/etc/keymap/us.bmap.gz b/etc/keymap/us.bmap.gz index ec8e0a03099aed931da9eb8463265782b0c67362..308ae02cf99162aff628f9699829db979d7d7724 100644 GIT binary patch delta 858 zcmV-g1Eu`$3GWH86ajzX{5YZKbdR3Y(|SSA=m9;Z$MvIp8p*#yPw8&mtNV1n9@Im6 zST{?Te2zH><)WU~U3yk`>QOzS{W2iizRRCA)h1_ZOy1O*I#X|orX%Kes-`p|zIa-k;VLrc(*4b>qN zM)MC!lW+DvCTfj~rZE&`ZuQ^dTm3xW<_o^v7k!7H?>qhY>;KEYUB26w>wjwb`{EcF z?Y}tIe@E;evHx0W7B6+uAg$6E?`tG4ZPG5)VpAjaQYDF`@yU#+WM#Pjc%=oICoSTn zDgJ|8{H}T>XNP}E`6cG>GTml@S!jC9BD2^mF-y&|xc;lg$zPCOv)oK2zqjT4ms0=5 zvHm+^|C7%@+<&o5{{ElxuP`gkD${3Hn>A*wS!dRp4HKAu1G3R<`V0A|zyEUk|9APb zcC`Or_y6znXYK6l|IhY+L8iL@%jQQPR$~p;Vjb3F12%tR6INk4wqghY&+!(w@dB^# z9YBW1E;VXd$AAuaS(@a z7@N_B&oSp9F5*0P;VgFID2|{X1K5Vr`G-p9Ul`~78$hM=FPX~w&rJ0HNAG`wsPz6f zwfxi9|Ln})2PySm9P7U$_K%pq7R~UeLjzjT81HOrkVhNZNAergqY4Sq_+$o(>`4D{ z7^VfxLkk?5V3CW@_9D)|Qhuqp|HqyG759GuQ<(p;e<}4}9P7U$_CNXj!~GY_3{lv kru|EkF$5cvFa#WvFa#WvFa!q;KO6o3A3rZtPzQkk0H#FTB>(^b delta 841 zcmV-P1GfC{3GWH86ajyc{3rCB?$MKaS}*7sJ)p<*xPFvRBl&meDc!Amb)W9ngL+60 z>t^Ya&oSqqT-5WrOV8>~J*r2vUj}5`clooX+T=`)$(veJXX;JSbj18_ocsea-*k?X zU+vfY89UMZ)7O7fDCPInKIdzE-q-p%U+)`yqi+b-)`q%JADVwdF4Tm4XbBp!p*m#3 zX#PQI^3DFoM6GerG=_rAt^QkltDooFe8IQ-qVMqYeWxFP{eStl%Xj;7{ZB1_UmOFY z{TIjj?}+^)=C74z@lq!Z(khMdzDDxWChbx!HZ@W&Rgy>=pUj9#R)+hJS6YyH(jrcp z;y=j6@2XdFcBp@pUt<0)(`^=*g{H?WGK%VH8`~~SX%gt2sdt1JLDfM3* z>%SxRKl%K_{TIvR@Bb6wh!8mr;#4|M3#Ha0hpB4-fDVkFW)ca1C+(;{)E|Cf?u%p5QThu>vbmntzDr zzc=1`=c~N;iBCOzi23744G1B`{K1DL#Qebq7o;@*`;qZlHh)q&|LSau$=g~xsriRa zY)3a1U?G35pa)B_7)x*!%SQ5_z&Y%}Nu0(7oWTJc!*P7Xr;+?Sa0lZm0aQBwlBvA^%tZfx^!_)9O7DMD z%Rhbn&(8dPkW&A}vHm+^|A_f((F~6|G@uoY@xE*Zd9sDs*oU!PiCOVj`Sag zVOqdEw7{VW7P4f86k$+WVj6`XB4R!up?U{r}nipM3s_zW>pakpxmYm;GPPKVSX#tAD=v z???a4UH_N!?^pl*>fdkv`_aF1*Z==-|8vj(f2V)?pZ=%+>3{m4{-^(E+P{-A1RRr~ T1V0V4(f|Je5~_Lw2Y~ Date: Sun, 6 Oct 2019 18:03:34 +0700 Subject: [PATCH 16/45] Network interfaces --- etc/network/interfaces | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/etc/network/interfaces b/etc/network/interfaces index 84c14d5d..83829d74 100644 --- a/etc/network/interfaces +++ b/etc/network/interfaces @@ -1,12 +1,11 @@ auto lo iface lo inet loopback +auto eth0 +iface eth0 inet dhcp + hostname box + auto wlan0 iface wlan0 inet dhcp hostname box - udhcpc_opts --timeout=1 --retries=1 -auto eth0 -iface eth0 inet dhcp - hostname box - udhcpc_opts --timeout=1 --retries=1 From 7e653670e509c0c4c68f05ea37b6c182a95b752c Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:04:05 +0700 Subject: [PATCH 17/45] SSH configuration --- etc/ssh/sshd_config | 104 +++----------------------------------------- 1 file changed, 6 insertions(+), 98 deletions(-) diff --git a/etc/ssh/sshd_config b/etc/ssh/sshd_config index a7fbf901..fbaabaff 100644 --- a/etc/ssh/sshd_config +++ b/etc/ssh/sshd_config @@ -1,16 +1,4 @@ -# $OpenBSD: sshd_config,v 1.102 2018/02/16 02:32:40 djm Exp $ - -# This is the sshd server system-wide configuration file. See -# sshd_config(5) for more information. - -# This sshd was compiled with PATH=/bin:/usr/bin:/sbin:/usr/sbin - -# The strategy used for options in the default sshd_config shipped with -# OpenSSH is to specify options with their default value where -# possible, but leave them commented. Uncommented options override the -# default value. - -#Port 22 +Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: @@ -19,102 +7,22 @@ #HostKey /etc/ssh/ssh_host_ecdsa_key #HostKey /etc/ssh/ssh_host_ed25519_key -# Only generate ed25519 and RSA host keys -HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa - # Ciphers and keying #RekeyLimit default none -# Logging -#SyslogFacility AUTH -#LogLevel INFO - -# Authentication: #LoginGraceTime 2m -#PermitRootLogin no +# Remove this later +PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 -#PubkeyAuthentication yes - -# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 -# but this is overridden so installations will only check .ssh/authorized_keys +PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys - -#AuthorizedPrincipalsFile none - -#AuthorizedKeysCommand none -#AuthorizedKeysCommandUser nobody - -# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts -#HostbasedAuthentication no -# Change to yes if you don't trust ~/.ssh/known_hosts for -# HostbasedAuthentication -#IgnoreUserKnownHosts no -# Don't read the user's ~/.rhosts and ~/.shosts files -#IgnoreRhosts yes - -# To disable tunneled clear text passwords, change to no here! -#PasswordAuthentication yes -#PermitEmptyPasswords no - -# Change to no to disable s/key passwords -#ChallengeResponseAuthentication yes - -# Kerberos options -#KerberosAuthentication no -#KerberosOrLocalPasswd yes -#KerberosTicketCleanup yes -#KerberosGetAFSToken no - -# GSSAPI options -#GSSAPIAuthentication no -#GSSAPICleanupCredentials yes - -# Set this to 'yes' to enable PAM authentication, account processing, -# and session processing. If this is enabled, PAM authentication will -# be allowed through the ChallengeResponseAuthentication and -# PasswordAuthentication. Depending on your PAM configuration, -# PAM authentication via ChallengeResponseAuthentication may bypass -# the setting of "PermitRootLogin without-password". -# If you just want the PAM account and session checks to run without -# PAM authentication, then enable this but set PasswordAuthentication -# and ChallengeResponseAuthentication to 'no'. -#UsePAM no - -#AllowAgentForwarding yes -#AllowTcpForwarding yes -#GatewayPorts no -#X11Forwarding no -#X11DisplayOffset 10 -#X11UseLocalhost yes -#PermitTTY yes -#PrintMotd yes -#PrintLastLog yes -#TCPKeepAlive yes -#UseLogin no -#PermitUserEnvironment no -#Compression delayed -#ClientAliveInterval 0 -#ClientAliveCountMax 3 -#UseDNS no -#PidFile /run/sshd.pid -#MaxStartups 10:30:100 -#PermitTunnel no -#ChrootDirectory none -#VersionAddendum none - -# no default banner path -#Banner none +# Change this once authorized keys is set up +PasswordAuthentication yes # override default of no subsystems Subsystem sftp /usr/lib/ssh/sftp-server -# Example of overriding settings on a per-user basis -#Match User anoncvs -# X11Forwarding no -# AllowTcpForwarding no -# PermitTTY no -# ForceCommand cvs server From eb692f7a937e615bb1a7f75a6ad38482d04bb8d3 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:05:15 +0700 Subject: [PATCH 18/45] Password file --- etc/passwd | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/passwd b/etc/passwd index 2018a60b..c0509746 100644 --- a/etc/passwd +++ b/etc/passwd @@ -29,3 +29,4 @@ nobody:x:65534:65534:nobody:/:/sbin/nologin avahi:x:86:86:Avahi System User:/var/run/avahi-daemon:/sbin/nologin messagebus:x:100:101:messagebus:/dev/null:/sbin/nologin lncm:x:1001:1001:Linux User,,,:/home/lncm:/bin/ash +chrony:x:100:101:chrony:/var/log/chrony:/sbin/nologin From f7ff708ceb5f0bdd6a67aea9f64aeb926516e886 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:05:47 +0700 Subject: [PATCH 19/45] Add noma --- etc/init.d/noma | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 etc/init.d/noma diff --git a/etc/init.d/noma b/etc/init.d/noma new file mode 100755 index 00000000..b40d6cab --- /dev/null +++ b/etc/init.d/noma @@ -0,0 +1,27 @@ +#!/sbin/openrc-run + +# start up noma services + +depend() { + need net sshd docker +} + +start() { + ebegin "Starting NOMA Services" + cd /media/noma/compose/neutrino || exit 1 + docker-compose up -d + + noma lnd autounlock || exit 1 + + eend $? +} + +stop() { + noma stop || exit 1 + + # Attempt to force stop + cd /media/noma/compose/neutrino || exit 1 + docker-compose down + + eend $? +} From c1879b9b7b8ecd3e7827cf821f57434affeac8df Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:06:43 +0700 Subject: [PATCH 20/45] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1948de99..68f026e3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ home/lncm/README.* # Don't commit LNCM variant build stuff lncm-box-*.tar.gz *.img +lncm-box-*.img.zip # Don't commit work dir lncm-workdir/ From 2a5d59f843c2f8950e0a5c4bfca600176a7efd56 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:07:36 +0700 Subject: [PATCH 21/45] Update gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 68f026e3..f7ad1950 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ /.idea +# Don't commit .vagrant +.vagrant + # Alpine sensitive stuff: Docker key key.json From 0f1858c972b6c1361dda99a27b65f4c619eec034 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:22:02 +0700 Subject: [PATCH 22/45] Modify etc a bit more --- etc/init.d/iotwifi | 16 ---------------- etc/init.d/lncm-online | 2 +- etc/init.d/portainer | 17 ----------------- etc/iotwifi/wificfg.json | 16 ---------------- 4 files changed, 1 insertion(+), 50 deletions(-) delete mode 100755 etc/init.d/iotwifi delete mode 100755 etc/init.d/portainer delete mode 100644 etc/iotwifi/wificfg.json diff --git a/etc/init.d/iotwifi b/etc/init.d/iotwifi deleted file mode 100755 index 50bcaeb1..00000000 --- a/etc/init.d/iotwifi +++ /dev/null @@ -1,16 +0,0 @@ -#!/sbin/openrc-run - -depend() { - need net docker -} - -start() { - sleep 2 && \ - docker rm iotwifi && \ - docker stop iotwifi && \ - docker load --input /media/mmcblk0p1/iotwifi.tar.gz && \ - docker run --name=iotwifi -d --restart=unless-stopped --privileged --net host \ - -v /etc/iotwifi:/cfg \ - -v /etc/wpa_supplicant:/etc/wpa_supplicant \ - cjimti/iotwifi -} diff --git a/etc/init.d/lncm-online b/etc/init.d/lncm-online index 8b789e7b..a267abe5 100755 --- a/etc/init.d/lncm-online +++ b/etc/init.d/lncm-online @@ -20,7 +20,7 @@ start() { ONLINE=1 COUNT=0 - while [ $ONLINE -eq 1 ] || [ $COUNT -lt 10 ] + while [ $ONLINE -eq 1 ] && [ $COUNT -lt 10 ] do echo "Checking for internet connection for 10 seconds..." net_check diff --git a/etc/init.d/portainer b/etc/init.d/portainer deleted file mode 100755 index 8d5c2b1b..00000000 --- a/etc/init.d/portainer +++ /dev/null @@ -1,17 +0,0 @@ -#!/sbin/openrc-run - -depend() { - need net docker -} - -start() { - ebegin "Starting portainer" - - sleep 2 && \ - docker volume create portainer_data && \ - docker run --rm -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock \ - -v portainer_data:/data portainer/portainer && \ - echo "Portainer can be reached on http://box.local:9000" - - eend $? -} diff --git a/etc/iotwifi/wificfg.json b/etc/iotwifi/wificfg.json deleted file mode 100644 index 389f6f77..00000000 --- a/etc/iotwifi/wificfg.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "dnsmasq_cfg": { - "address": "/#/192.168.27.1", - "dhcp_range": "192.168.27.100,192.168.27.150,1h", - "vendor_class": "set:device,IoT" - }, - "host_apd_cfg": { - "ip": "192.168.27.1", - "ssid": "LNCM-Box", - "wpa_passphrase":"lncm box", - "channel": "6" - }, - "wpa_supplicant_cfg": { - "cfg_file": "/etc/wpa_supplicant/wpa_supplicant.conf" - } -} From d0951e248e4bd19692b200b275728a6ddec2b996 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:24:17 +0700 Subject: [PATCH 23/45] Remove docker from boot --- etc/runlevels/boot/docker | 1 - etc/runlevels/boot/iotwifi | 1 - 2 files changed, 2 deletions(-) delete mode 120000 etc/runlevels/boot/docker delete mode 120000 etc/runlevels/boot/iotwifi diff --git a/etc/runlevels/boot/docker b/etc/runlevels/boot/docker deleted file mode 120000 index 34505c7a..00000000 --- a/etc/runlevels/boot/docker +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/docker \ No newline at end of file diff --git a/etc/runlevels/boot/iotwifi b/etc/runlevels/boot/iotwifi deleted file mode 120000 index 4b77cefd..00000000 --- a/etc/runlevels/boot/iotwifi +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/iotwifi \ No newline at end of file From a74f6f6e54888cce287cd7e337b1921a5d17e57f Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:29:07 +0700 Subject: [PATCH 24/45] Remove nginx --- etc/init.d/nginx | 36 ------------------------------------ etc/runlevels/boot/nginx | 1 - 2 files changed, 37 deletions(-) delete mode 100755 etc/init.d/nginx delete mode 120000 etc/runlevels/boot/nginx diff --git a/etc/init.d/nginx b/etc/init.d/nginx deleted file mode 100755 index c36c263f..00000000 --- a/etc/init.d/nginx +++ /dev/null @@ -1,36 +0,0 @@ -#!/sbin/openrc-run - -depend() { - need net docker - after iotwifi - before lncm-online -} - -start() { - sleep 2 && \ - docker stop nginx && \ - docker rm nginx && \ - docker load --input /media/mmcblk0p1/nginx.tar.gz - - # Lets see which config file to use - if [[ ! -d /media/important/important/nginx ]]; then - # Old location - # nginx doesn't exist in /media/important/important so use the location on filesystem - - docker run --name=nginx -d --restart=unless-stopped --net host \ - -v /etc/nginx:/etc/nginx \ - -v /var/log/nginx:/var/log/nginx \ - -v /home/lncm/public_html:/www \ - nginx:1.14.2-alpine - else - # Location on persistent store - docker run --name=nginx -d --restart=unless-stopped --net host \ - -v /media/important/important/nginx:/etc/nginx \ - -v /var/log/nginx:/var/log/nginx \ - -v /home/lncm/public_html:/www \ - nginx:1.14.2-alpine - # Store an empty file so we can script that we are using the important mount rather than filesystem - touch /media/important/important/using-nginx-important-mount - # TODO: Delete or Move old nginx location (or just leave it alone) - fi -} diff --git a/etc/runlevels/boot/nginx b/etc/runlevels/boot/nginx deleted file mode 120000 index f3148c4c..00000000 --- a/etc/runlevels/boot/nginx +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/nginx \ No newline at end of file From c0e256c3242cae0d2568cdc36308e64107b839dc Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:30:25 +0700 Subject: [PATCH 25/45] Fix typo in lncm-online --- etc/init.d/lncm-online | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/init.d/lncm-online b/etc/init.d/lncm-online index a267abe5..7fb97705 100755 --- a/etc/init.d/lncm-online +++ b/etc/init.d/lncm-online @@ -24,7 +24,7 @@ start() { do echo "Checking for internet connection for 10 seconds..." net_check - COUNT=$((count + 1)) + COUNT=$((COUNT + 1)) sleep 1 done From 50ff46a560463ec4ca29020d32b98960a1240ca3 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:32:17 +0700 Subject: [PATCH 26/45] Update lncm-post --- etc/init.d/lncm-post | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index b2acdc23..7343f26e 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -44,7 +44,7 @@ start() { echo "Install Noma dependencies in case user wants to install it" /sbin/apk add py3-psutil #Uncomment noma for now because noma stop seems to be broken - #/usr/bin/pip3 install noma==0.4.5 + /usr/bin/pip3 install noma==0.5.0 } install_toml() { From 1279c6345b87ea0aafbd45be9e084d1d5b4deee2 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 18:51:04 +0700 Subject: [PATCH 27/45] Remove Setup tor --- etc/init.d/lncm-post | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 7343f26e..1f0150aa 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -148,7 +148,7 @@ start() { setup_tor() { CHECKTOR_HOSTNAME=1 # Check to see if Tor generated directory exists - while [ ! -d /var/lib/tor/lnd-v3 ] && [ $CHECKTOR_HOSTNAME -lt 10 ]; + while [ ! -d /var/lib/tor/ssh-v3 ] && [ $CHECKTOR_HOSTNAME -lt 10 ]; do echo "Tor generated directory doesn't exist yet.. waiting"; CHECKTOR_HOSTNAME=$((CHECKTOR_HOSTNAME+1)) @@ -304,7 +304,8 @@ start() { #generate_rpc install_tor enable_tor - setup_tor + #setup_tor + # Copy into path #config_bitcoind #config_lnd From a093a7c082488fdda9794c89c05a501dda8ab24e Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 19:15:41 +0700 Subject: [PATCH 28/45] Fix up lncm-post --- etc/init.d/lncm-post | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 1f0150aa..6651aa15 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -267,8 +267,8 @@ start() { } persist_state() { - echo "Backup apkovl.tar.gz to USB storage" - /sbin/lbu package /media/important/important/box.apkovl.tar.gz + echo "Backup apkovl.tar.gz to Root" + /sbin/lbu package /box.apkovl.tar.gz } disable_post() { From 6a35ede4c6a39c9f3f2deaa01ac2bac17eaee8bd Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 19:34:50 +0700 Subject: [PATCH 29/45] Add routines to Install Python 3 into lncm-post --- etc/init.d/lncm-post | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 6651aa15..1fd849d9 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -29,6 +29,14 @@ start() { fi /sbin/setup-apkcache /var/cache/apk } + + install_python3() { + echo "Install Python 3 and upgrade PIP" + /sbin/apk update && \ + /sbin/apk add python3 curl jq + + /usr/bin/pip3 install --upgrade pip + } install_compose() { echo "Install docker-compose and dependencies" @@ -291,6 +299,7 @@ start() { fi move_cache + install_python3 #install_compose #install_toml #install_noma From 0fd9bd17611d2b6aa2841c47f84f568902cd0861 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 19:36:50 +0700 Subject: [PATCH 30/45] Install Alpine SDA devtools --- etc/init.d/lncm-post | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 1fd849d9..f4a9d06a 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -38,6 +38,11 @@ start() { /usr/bin/pip3 install --upgrade pip } + install_alpine_sdk() { + echo "Install alpine devtools (used for building)" + /sbin/apk add alpine-sdk + } + install_compose() { echo "Install docker-compose and dependencies" # jq for help with parsing JSON @@ -300,6 +305,7 @@ start() { move_cache install_python3 + install_alpine_sdk #install_compose #install_toml #install_noma From 3238e9f27dec56e494273ac9495de0ab941f4476 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 19:45:04 +0700 Subject: [PATCH 31/45] Add python3 libraries --- etc/init.d/lncm-post | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index f4a9d06a..b9f5eb12 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -33,7 +33,7 @@ start() { install_python3() { echo "Install Python 3 and upgrade PIP" /sbin/apk update && \ - /sbin/apk add python3 curl jq + /sbin/apk add python3 python3-dev curl jq /usr/bin/pip3 install --upgrade pip } @@ -304,8 +304,8 @@ start() { fi move_cache - install_python3 install_alpine_sdk + install_python3 #install_compose #install_toml #install_noma From 90b44e89e810547353891336b2d1be5e9bfbb129 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 20:08:05 +0700 Subject: [PATCH 32/45] Add more build dependencies --- etc/init.d/lncm-post | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index b9f5eb12..96b4e0a7 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -40,7 +40,7 @@ start() { install_alpine_sdk() { echo "Install alpine devtools (used for building)" - /sbin/apk add alpine-sdk + /sbin/apk add alpine-sdk linux-headers libffi-dev } install_compose() { From 72e829552ba663f5851921a7fcd219969ad21c8f Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:38:22 +0700 Subject: [PATCH 33/45] Remove this stuff --- etc/ssh/ssh_host_dsa_key | 1 - etc/ssh/ssh_host_dsa_key.pub | 1 - etc/ssh/ssh_host_ecdsa_key | 1 - etc/ssh/ssh_host_ecdsa_key.pub | 1 - 4 files changed, 4 deletions(-) delete mode 100644 etc/ssh/ssh_host_dsa_key delete mode 100644 etc/ssh/ssh_host_dsa_key.pub delete mode 100644 etc/ssh/ssh_host_ecdsa_key delete mode 100644 etc/ssh/ssh_host_ecdsa_key.pub diff --git a/etc/ssh/ssh_host_dsa_key b/etc/ssh/ssh_host_dsa_key deleted file mode 100644 index d842edf3..00000000 --- a/etc/ssh/ssh_host_dsa_key +++ /dev/null @@ -1 +0,0 @@ -dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_dsa_key.pub b/etc/ssh/ssh_host_dsa_key.pub deleted file mode 100644 index d842edf3..00000000 --- a/etc/ssh/ssh_host_dsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_ecdsa_key b/etc/ssh/ssh_host_ecdsa_key deleted file mode 100644 index d842edf3..00000000 --- a/etc/ssh/ssh_host_ecdsa_key +++ /dev/null @@ -1 +0,0 @@ -dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_ecdsa_key.pub b/etc/ssh/ssh_host_ecdsa_key.pub deleted file mode 100644 index d842edf3..00000000 --- a/etc/ssh/ssh_host_ecdsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -dummy file to prevent key generation \ No newline at end of file From 5d3aa66ee9bb3fd972115eb9bbfbeffad853c43e Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:39:00 +0700 Subject: [PATCH 34/45] Add ssh host keys to gitignore --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index f7ad1950..f2087a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,14 @@ lncm-workdir/ # Don't apkvol *.apkovl.tar.gz + +# Prevent commiting ssh host stuff +etc/ssh/ssh_host_dsa_key +etc/ssh/ssh_host_dsa_key.pub +etc/ssh/ssh_host_ecdsa_key +etc/ssh/ssh_host_ecdsa_key.pub +etc/ssh/ssh_host_ed25519_key +etc/ssh/ssh_host_ed25519_key.pub +etc/ssh/ssh_host_rsa_key +etc/ssh/ssh_host_rsa_key.pub + From d646154d2728b10ba71d28d71b9ccd01d88e11b0 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:41:16 +0700 Subject: [PATCH 35/45] Put back host key --- etc/ssh/sshd_config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/ssh/sshd_config b/etc/ssh/sshd_config index fbaabaff..72c1ef4e 100644 --- a/etc/ssh/sshd_config +++ b/etc/ssh/sshd_config @@ -7,6 +7,8 @@ Port 22 #HostKey /etc/ssh/ssh_host_ecdsa_key #HostKey /etc/ssh/ssh_host_ed25519_key +HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa + # Ciphers and keying #RekeyLimit default none From a574eb5ba59f28e4819d191f28e6114a58273d72 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:43:04 +0700 Subject: [PATCH 36/45] Remove persist state --- etc/init.d/lncm-post | 6 ------ 1 file changed, 6 deletions(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 96b4e0a7..47fe1508 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -279,11 +279,6 @@ start() { /usr/bin/crontab /home/lncm/crontab } - persist_state() { - echo "Backup apkovl.tar.gz to Root" - /sbin/lbu package /box.apkovl.tar.gz - } - disable_post() { echo "Remove lncm-post from boot" /sbin/rc-update del lncm-post default @@ -329,7 +324,6 @@ start() { #install_crontab disable_post #enable_compose - persist_state } main From c1699b95a59ecb6b98aab121c9399d0f7fb0600b Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:46:03 +0700 Subject: [PATCH 37/45] Add dummy keys to speed up key generation --- .gitignore | 10 ---------- etc/ssh/ssh_host_dsa_key | 1 + etc/ssh/ssh_host_dsa_key.pub | 1 + etc/ssh/ssh_host_ecdsa_key | 1 + etc/ssh/ssh_host_ecdsa_key.pub | 1 + 5 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 etc/ssh/ssh_host_dsa_key create mode 100644 etc/ssh/ssh_host_dsa_key.pub create mode 100644 etc/ssh/ssh_host_ecdsa_key create mode 100644 etc/ssh/ssh_host_ecdsa_key.pub diff --git a/.gitignore b/.gitignore index f2087a2b..7714aaf4 100644 --- a/.gitignore +++ b/.gitignore @@ -35,13 +35,3 @@ lncm-workdir/ # Don't apkvol *.apkovl.tar.gz -# Prevent commiting ssh host stuff -etc/ssh/ssh_host_dsa_key -etc/ssh/ssh_host_dsa_key.pub -etc/ssh/ssh_host_ecdsa_key -etc/ssh/ssh_host_ecdsa_key.pub -etc/ssh/ssh_host_ed25519_key -etc/ssh/ssh_host_ed25519_key.pub -etc/ssh/ssh_host_rsa_key -etc/ssh/ssh_host_rsa_key.pub - diff --git a/etc/ssh/ssh_host_dsa_key b/etc/ssh/ssh_host_dsa_key new file mode 100644 index 00000000..d842edf3 --- /dev/null +++ b/etc/ssh/ssh_host_dsa_key @@ -0,0 +1 @@ +dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_dsa_key.pub b/etc/ssh/ssh_host_dsa_key.pub new file mode 100644 index 00000000..d842edf3 --- /dev/null +++ b/etc/ssh/ssh_host_dsa_key.pub @@ -0,0 +1 @@ +dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_ecdsa_key b/etc/ssh/ssh_host_ecdsa_key new file mode 100644 index 00000000..d842edf3 --- /dev/null +++ b/etc/ssh/ssh_host_ecdsa_key @@ -0,0 +1 @@ +dummy file to prevent key generation \ No newline at end of file diff --git a/etc/ssh/ssh_host_ecdsa_key.pub b/etc/ssh/ssh_host_ecdsa_key.pub new file mode 100644 index 00000000..d842edf3 --- /dev/null +++ b/etc/ssh/ssh_host_ecdsa_key.pub @@ -0,0 +1 @@ +dummy file to prevent key generation \ No newline at end of file From 29b06d39add2c0a01881623b7352465636d4ff61 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 21:53:45 +0700 Subject: [PATCH 38/45] add install_utils --- etc/init.d/lncm-post | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 47fe1508..68e0061f 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -33,11 +33,16 @@ start() { install_python3() { echo "Install Python 3 and upgrade PIP" /sbin/apk update && \ - /sbin/apk add python3 python3-dev curl jq + /sbin/apk add python3 python3-dev /usr/bin/pip3 install --upgrade pip } + install_utils() { + /sbin/apk update && \ + /sbin/apk add curl jq + } + install_alpine_sdk() { echo "Install alpine devtools (used for building)" /sbin/apk add alpine-sdk linux-headers libffi-dev @@ -300,6 +305,7 @@ start() { move_cache install_alpine_sdk + install_utils install_python3 #install_compose #install_toml From 321cdf193e8ee4641acae12f346f795fba5e7f0d Mon Sep 17 00:00:00 2001 From: nolim1t Date: Sun, 6 Oct 2019 22:48:49 +0700 Subject: [PATCH 39/45] Update lncm-online --- etc/init.d/lncm-online | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/init.d/lncm-online b/etc/init.d/lncm-online index 7fb97705..39e088d3 100755 --- a/etc/init.d/lncm-online +++ b/etc/init.d/lncm-online @@ -32,7 +32,9 @@ start() { echo "Connected to internet" exit 0 else - echo "Not connected to internet after 30 seconds" + echo "Not connected to internet.. please update wpa_supplicant" + echo "and then reboot to continue the setup process" + exit 1 fi eend $? From 819d927a85005494f3fe9ba33c6a4f9aad28d0a1 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 04:47:10 +0000 Subject: [PATCH 40/45] Remove download version --- make_img.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/make_img.sh b/make_img.sh index f58baa25..c1b8b2eb 100755 --- a/make_img.sh +++ b/make_img.sh @@ -6,8 +6,6 @@ # For Outputing an image OUTPUT_VERSION=v0.5.0 -# For Libraries -DOWNLOAD_VERSION=v0.4.1 # For fetching Alpine ALP=alpine-rpi-3.10.2-aarch64.tar.gz From 392e9fc1ce4b46cd586f886b9ed0e3bcaa2e2a7b Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 04:47:22 +0000 Subject: [PATCH 41/45] Add .ssh to lncm --- etc/apk/protected_paths.d/lbu.list | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/apk/protected_paths.d/lbu.list b/etc/apk/protected_paths.d/lbu.list index 9dcd9cfb..9a460e0c 100644 --- a/etc/apk/protected_paths.d/lbu.list +++ b/etc/apk/protected_paths.d/lbu.list @@ -9,6 +9,7 @@ +etc/init.d/noma +etc/init.d/sshd +etc/init.d/wpa_supplicant ++home/lncm/.ssh +home/lncm/bitcoin +home/lncm/litecoin +home/lncm/lnd From 0e131e91161fbf3de75219241381d88b65cf6689 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 11:36:52 +0000 Subject: [PATCH 42/45] Trim down the install to not use the cache. Remove avahi, docker, dbus, docker-compose from the initial install. It should get installed after --- etc/apk/world | 4 -- etc/init.d/avahi-daemon | 30 --------------- etc/init.d/docker-compose | 66 --------------------------------- etc/init.d/lncm | 1 - etc/init.d/lncm-post | 43 +++++++++++---------- etc/init.d/noma | 27 -------------- etc/runlevels/boot/avahi-daemon | 1 - etc/runlevels/boot/dbus | 1 - etc/runlevels/default/docker | 1 - make_img.sh | 9 ----- 10 files changed, 21 insertions(+), 162 deletions(-) delete mode 100755 etc/init.d/avahi-daemon delete mode 100755 etc/init.d/docker-compose delete mode 100755 etc/init.d/noma delete mode 120000 etc/runlevels/boot/avahi-daemon delete mode 120000 etc/runlevels/boot/dbus delete mode 120000 etc/runlevels/default/docker diff --git a/etc/apk/world b/etc/apk/world index 3d0b784a..ba186769 100644 --- a/etc/apk/world +++ b/etc/apk/world @@ -1,11 +1,7 @@ alpine-base -dbus avahi chrony -docker openssh openssl wireless-tools wpa_supplicant -e2fsprogs -parted diff --git a/etc/init.d/avahi-daemon b/etc/init.d/avahi-daemon deleted file mode 100755 index cb2a3203..00000000 --- a/etc/init.d/avahi-daemon +++ /dev/null @@ -1,30 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -extra_started_commands="reload" - -depend() { - before netmount nfsmount - use net - need dbus hostname - after iotwifi -} - -start() { - ebegin "Starting avahi-daemon" - /usr/sbin/avahi-daemon -D - eend $? -} - -stop() { - ebegin "Stopping avahi-daemon" - /usr/sbin/avahi-daemon -k - eend $? -} - -reload() { - ebegin "Reloading avahi-daemon" - /usr/sbin/avahi-daemon -r - eend $? -} diff --git a/etc/init.d/docker-compose b/etc/init.d/docker-compose deleted file mode 100755 index 4d9f6462..00000000 --- a/etc/init.d/docker-compose +++ /dev/null @@ -1,66 +0,0 @@ -#!/sbin/openrc-run - -# docker-compose init script - -depend() { - need net sshd docker lncm-online -} - -start() { - ebegin "Starting docker-compose" - - # Lnd - if [ ! -d /media/important/important/lnd ]; then - echo "Error: lnd directory not found" - exit 1 - fi - if [ ! -f /media/important/important/lnd/lnd.conf ]; then - echo "Error: lnd configuration file not found" - exit 1 - fi - - # Bitcoind - if [ ! -d /media/archive/archive/bitcoin ]; then - echo "Error: bitcoind directory not found" - exit 1 - fi - if [ ! -f /media/archive/archive/bitcoin/bitcoin.conf ]; then - echo "Error: bitcoin configuration not found" - exit 1 - fi - - # Docker compose - if [ ! -d /home/lncm/compose ]; then - echo "Error: docker compose directory not found!" - exit 1 - fi - if [ ! -f /home/lncm/compose/docker-compose.yml ]; then - echo "Error: docker compose configuration not found!" - exit 1 - fi - - # All good - cd /home/lncm/compose || exit 1 - docker-compose up -d - - eend $? -} - -stop() { - ebegin "Stopping docker compose" - - # Invoke either Noma or Mana - if [[ -f /usr/bin/noma ]]; then - /usr/bin/noma stop - else - # Invoke Mana if noma doesn't exist - if [[ -f /usr/local/sbin/mana ]]; then - /usr/local/sbin/mana stop - fi - fi - # If neither noma or mana exists just kill docker-compose - cd /home/lncm/compose || exit 1 - docker-compose down - - eend $? -} diff --git a/etc/init.d/lncm b/etc/init.d/lncm index 9a5d28cd..3a89bd2b 100755 --- a/etc/init.d/lncm +++ b/etc/init.d/lncm @@ -47,7 +47,6 @@ start() { install_tools() { echo "Add partitioning and filesystem tools" - /sbin/setup-apkcache /media/mmcblk0p1/cache && \ /sbin/apk add parted e2fsprogs } diff --git a/etc/init.d/lncm-post b/etc/init.d/lncm-post index 68e0061f..1e573b80 100755 --- a/etc/init.d/lncm-post +++ b/etc/init.d/lncm-post @@ -39,8 +39,25 @@ start() { } install_utils() { + echo "Installing utils (avahi/dbus/curl/jq)" /sbin/apk update && \ - /sbin/apk add curl jq + /sbin/apk add dbus avahi curl jq docker + } + + config_avahi() { + echo "Configuring Avahi" + /sbin/rc-update add dbus boot || echo "Unable to add dbus to boot runlevels" + /sbin/rc-update add avahi-daemon boot || echo "Unable to add avahi to boot runlevels" + echo "Starting DBUS and AVAHI" + /etc/init.d/dbus start || echo "Failed to start dbus" + /etc/init.d/avahi-daemon start || echo "Failed to start avahi" + } + + config_docker() { + echo "Configuring docker" + /sbin/rc-update add docker default + echo "Starting docker" + /etc/init.d/docker start || echo "Failed to start docker" } install_alpine_sdk() { @@ -304,32 +321,14 @@ start() { fi move_cache - install_alpine_sdk install_utils + config_docker + config_avahi + install_alpine_sdk install_python3 - #install_compose - #install_toml - #install_noma - #usb_setup - #verify_usb - # Fetch invoicer into path - #fetch_invoicerconfig - #fetch_rpcauth - #check_rpc - # Configure invoicer, and services stage - #generate_rpc install_tor enable_tor - #setup_tor - - # Copy into path - #config_bitcoind - #config_lnd - #config_nginx - #fetch_invoicerui - #install_crontab disable_post - #enable_compose } main diff --git a/etc/init.d/noma b/etc/init.d/noma deleted file mode 100755 index b40d6cab..00000000 --- a/etc/init.d/noma +++ /dev/null @@ -1,27 +0,0 @@ -#!/sbin/openrc-run - -# start up noma services - -depend() { - need net sshd docker -} - -start() { - ebegin "Starting NOMA Services" - cd /media/noma/compose/neutrino || exit 1 - docker-compose up -d - - noma lnd autounlock || exit 1 - - eend $? -} - -stop() { - noma stop || exit 1 - - # Attempt to force stop - cd /media/noma/compose/neutrino || exit 1 - docker-compose down - - eend $? -} diff --git a/etc/runlevels/boot/avahi-daemon b/etc/runlevels/boot/avahi-daemon deleted file mode 120000 index 9a26743f..00000000 --- a/etc/runlevels/boot/avahi-daemon +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/avahi-daemon \ No newline at end of file diff --git a/etc/runlevels/boot/dbus b/etc/runlevels/boot/dbus deleted file mode 120000 index a9e632ad..00000000 --- a/etc/runlevels/boot/dbus +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/dbus \ No newline at end of file diff --git a/etc/runlevels/default/docker b/etc/runlevels/default/docker deleted file mode 120000 index 34505c7a..00000000 --- a/etc/runlevels/default/docker +++ /dev/null @@ -1 +0,0 @@ -/etc/init.d/docker \ No newline at end of file diff --git a/make_img.sh b/make_img.sh index c1b8b2eb..70c4b629 100755 --- a/make_img.sh +++ b/make_img.sh @@ -14,7 +14,6 @@ ARCH=aarch64 REL=v3.10 IMG=lncm-box-${OUTPUT_VERSION}.img -CACHE=cache-3.10-aarch64.tar.gz MNT=/mnt/lncm if [ "$(id -u)" -ne "0" ]; then @@ -109,11 +108,6 @@ if ! [ -f ${ALP} ]; then wget --no-verbose http://dl-cdn.alpinelinux.org/alpine/${REL}/releases/${ARCH}/${ALP} || echo "Error fetching alpine" fi -if ! [ -f ${CACHE} ]; then - echo "${CACHE} not found, fetching..." - wget --no-verbose https://gitlab.com/nolim1t/aarch64-alpine-apkvol/raw/834fa018f8ea518f6dee60ffd2967fc5d4b36ec0/${CACHE} || echo "Error fetching cache" -fi - echo "Create and mount 256MB image" dd if=/dev/zero of=${IMG} bs=1M count=256 && \ DEV=$(losetup -f) && \ @@ -132,9 +126,6 @@ mount "${DEV}"p1 "${MNT}" echo "Extract alpine distribution" tar -xzf ${ALP} -C ${MNT}/ --no-same-owner || echo "Can't extract alpine" -echo "Extract cache dir for docker and avahi" -tar -xzf ${CACHE} -C ${MNT}/ --no-same-owner || echo "Can't extract cache" - echo "Copy latest box.apkovl tarball" cp ../box.apkovl.tar.gz ${MNT} || echo "Can't extract alpine box" From c83509f16f8856f0360fab3ec0cadb16624945a7 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 12:15:53 +0000 Subject: [PATCH 43/45] Work on armhf build --- make_img.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/make_img.sh b/make_img.sh index 70c4b629..4ce03de5 100755 --- a/make_img.sh +++ b/make_img.sh @@ -8,12 +8,16 @@ OUTPUT_VERSION=v0.5.0 # For fetching Alpine -ALP=alpine-rpi-3.10.2-aarch64.tar.gz ARCH=aarch64 +ARCH32=armhf +ALP=alpine-rpi-3.10.2-${ARCH}.tar.gz +ALP32=alpine-rpi-3.10.2-${ARCH32}.tar.gz + # Which alpine release directory REL=v3.10 IMG=lncm-box-${OUTPUT_VERSION}.img +IMG32=lncm-box-${OUTPUT_VERSION}-armhf.img MNT=/mnt/lncm if [ "$(id -u)" -ne "0" ]; then @@ -45,8 +49,8 @@ check_deps() { echo "Found required dependencies" } -echo "Building ${IMG}" -echo "Using ${ALP} as base distribution" +echo "Building ${IMG} and ${IMG32}" +echo "Using ${ALP} and ${ALP32} as base distribution" echo 'Check for existing wpa_supplicant.automatic.conf' if [ -f ./wpa_supplicant.automatic.conf ]; then @@ -108,6 +112,11 @@ if ! [ -f ${ALP} ]; then wget --no-verbose http://dl-cdn.alpinelinux.org/alpine/${REL}/releases/${ARCH}/${ALP} || echo "Error fetching alpine" fi +if ! [ -f ${ALP32} ]; then + echo "${ALP32} not found, fetching..." + wget --no-verbose http://dl-cdn.alpinelinux.org/alpine/${REL}/releases/${ARCH32}/${ALP32} || echo "Error fetching alpine" +fi + echo "Create and mount 256MB image" dd if=/dev/zero of=${IMG} bs=1M count=256 && \ DEV=$(losetup -f) && \ @@ -140,5 +149,25 @@ echo "Compress img as zip" zip -r ${IMG}.zip ${IMG} +# Setup 32 bit +if [ -f ${ALP32} ]; then + dd if=/dev/zero of=${IMG32} bs=1M count=256 + DEV32=$(losetup -f) + losetup -f ${IMG32} + echo "Preparing 32 bit arm image" + mkfs.vfat "${DEV32}"p1 -IF 32 + echo "Mount FAT partition" + mount "${DEV32}"p1 "${MNT}" + echo "Extract alpine distribution and copy to 32 bit" + tar -xzf ${ALP32} -C ${MNT}/ --no-same-owner || echo "Cant extract alpine" + cp ../box.apkovl.tar.gz ${MNT} || echo "Cant extract alpine box" + sync + umount ${MNT} + losetup -d "${DEV32}" + zip -r ${IMG32}.zip ${IMG32} +fi + echo "Done!" echo "You may flash your ${IMG}.zip using Etcher or dd the ${IMG}" +echo "or you may flash your ${IMG32}.zip using Etcher or dd the ${IMG32}" + From 0cb57200b57bf026f97adb4c36f607f95f781260 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 12:23:20 +0000 Subject: [PATCH 44/45] Fix up armhf image creation script --- make_img.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/make_img.sh b/make_img.sh index 4ce03de5..fd6fe2df 100755 --- a/make_img.sh +++ b/make_img.sh @@ -151,11 +151,13 @@ zip -r ${IMG}.zip ${IMG} # Setup 32 bit if [ -f ${ALP32} ]; then - dd if=/dev/zero of=${IMG32} bs=1M count=256 - DEV32=$(losetup -f) - losetup -f ${IMG32} - echo "Preparing 32 bit arm image" + dd if=/dev/zero of=${IMG32} bs=1M count=256 && \ + DEV32=$(losetup -f) && \ + losetup -f ${IMG32} && \ + parted -s "${DEV32}" mklabel msdos mkpart p fat32 2048s 100% set 1 boot on && \ + echo "Preparing 32 bit arm image" && \ mkfs.vfat "${DEV32}"p1 -IF 32 + echo "Mount FAT partition" mount "${DEV32}"p1 "${MNT}" echo "Extract alpine distribution and copy to 32 bit" From dd69e61d1e3c855f825da28e3f5412cbbe477234 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 7 Oct 2019 12:35:02 +0000 Subject: [PATCH 45/45] Make chown on lncm home directory recusive --- etc/init.d/lncm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/init.d/lncm b/etc/init.d/lncm index 3a89bd2b..36b919e9 100755 --- a/etc/init.d/lncm +++ b/etc/init.d/lncm @@ -102,8 +102,8 @@ start() { setup_user() { echo "Create lncm home dir if necessary" /bin/mkdir -p /media/sd/home/lncm - echo "Set user permissions" - /bin/chown lncm:lncm /media/sd/home/lncm + echo "Fix user permissions" + /bin/chown -R lncm:lncm /media/sd/home/lncm } install_boot() {