diff --git a/.github/workflows/amd64-fatpack-image.yml b/.github/workflows/amd64-fatpack-image.yml new file mode 100644 index 000000000..11e2b30c1 --- /dev/null +++ b/.github/workflows/amd64-fatpack-image.yml @@ -0,0 +1,89 @@ +name: amd64-fatpack-image-build + +on: + workflow_dispatch: + #push: + # branches: [ "dev", "v1.8", "v1.9" ] + # paths: + # - 'build_sdcard.sh' + # - 'home.admin/bitcoin.install.sh' + # - 'home.admin/lnd.install.sh' + # - 'home.admin/cl.install.sh' + # - 'home.admin/cl-plugin.cln-grpc.sh' + # - 'home.admin/tor.install.sh' + # - 'home.admin/blitz.i2pd.sh' + # - 'home.admin/blitz.web.sh' + # - 'home.admin/bonus.nodejs.sh' + # - 'home.admin/bonus.rtl.sh' + # - 'home.admin/bonus.btcpayserver.sh' + # - 'home.admin/bonus.thunderhub.sh' + # - 'home.admin/bonus.jam.sh install' + # - 'home.admin/bonus.mempool.sh' + # - 'home.admin/blitz.web.api.sh' + # - 'home.admin/blitz.web.ui.sh' + # - 'home.admin/blitz.display.sh' + # - 'ci/amd64/**' + #pull_request: + # branches: [ "dev", "v1.8", "v1.9" ] + # paths: + # - 'build_sdcard.sh' + # - 'home.admin/bitcoin.install.sh' + # - 'home.admin/lnd.install.sh' + # - 'home.admin/cl.install.sh' + # - 'home.admin/cl-plugin.cln-grpc.sh' + # - 'home.admin/tor.install.sh' + # - 'home.admin/blitz.i2pd.sh' + # - 'home.admin/blitz.web.sh' + # - 'home.admin/bonus.nodejs.sh' + # - 'home.admin/bonus.rtl.sh' + # - 'home.admin/bonus.btcpayserver.sh' + # - 'home.admin/bonus.thunderhub.sh' + # - 'home.admin/bonus.jam.sh install' + # - 'home.admin/bonus.mempool.sh' + # - 'home.admin/blitz.web.api.sh' + # - 'home.admin/blitz.web.ui.sh' + # - 'home.admin/blitz.display.sh' + # - 'ci/amd64/**' + +jobs: + amd64-image-build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set values + run: | + echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV + echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + + - name: Hello RaspiBlitz + run: echo "Building the raspiblitz-amd64-debian-image-${{env.BUILD_DATE}}-${{env.BUILD_VERSION}} at " + + - name: Run the build script + run: | + cd ci/amd64 + bash packer.build.amd64-debian.sh fatpack $GITHUB_ACTOR $GITHUB_HEAD_REF + + - name: Compute checksum of the raw image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/ + sha256sum raspiblitz-amd64-debian-fatpack.qcow2 > raspiblitz-amd64-debian-fatpack.qcow2.sha256 + + - name: Compress image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/ + gzip -v9 raspiblitz-amd64-debian-fatpack.qcow2 + + - name: Compute checksum of the compressed image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/ + sha256sum raspiblitz-amd64-debian-fatpack.qcow2.gz > raspiblitz-amd64-debian-fatpack.qcow2.gz.sha256 + + - name: Upload the image and checksums + uses: actions/upload-artifact@v3 + with: + name: raspiblitz-amd64-image-${{env.BUILD_DATE}}-${{env.BUILD_VERSION}} + path: | + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/raspiblitz-amd64-debian-fatpack.qcow2.sha256 + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/raspiblitz-amd64-debian-fatpack.qcow2.gz + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu/raspiblitz-amd64-debian-fatpack.qcow2.gz.sha256 diff --git a/.github/workflows/amd64-lean-image.yml b/.github/workflows/amd64-lean-image.yml new file mode 100644 index 000000000..5dbc708de --- /dev/null +++ b/.github/workflows/amd64-lean-image.yml @@ -0,0 +1,67 @@ +name: amd64-lean-image-build + +on: + workflow_dispatch: + push: + branches: [ "dev", "v1.8", "v1.9" ] + paths: + - 'build_sdcard.sh' + - 'home.admin/bitcoin.install.sh' + - 'home.admin/tor.install.sh' + - 'home.admin/blitz.i2pd.sh' + - 'home.admin/blitz.web.sh' + - 'home.admin/blitz.display.sh' + - 'ci/amd64/**' + pull_request: + branches: [ "dev", "v1.8", "v1.9" ] + paths: + - 'build_sdcard.sh' + - 'home.admin/bitcoin.install.sh' + - 'home.admin/tor.install.sh' + - 'home.admin/blitz.i2pd.sh' + - 'home.admin/blitz.web.sh' + - 'home.admin/blitz.display.sh' + - 'ci/amd64/**' + +jobs: + amd64-image-build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set values + run: | + echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV + echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + + - name: Hello RaspiBlitz + run: echo "Building the raspiblitz-amd64-debian-image-${{env.BUILD_DATE}}-${{env.BUILD_VERSION}}" + + - name: Run the build script + run: | + cd ci/amd64 + bash packer.build.amd64-debian.sh lean $GITHUB_ACTOR $GITHUB_HEAD_REF + + - name: Compute checksum of the raw image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu + sha256sum raspiblitz-amd64-debian-lean.qcow2 > raspiblitz-amd64-debian-lean.qcow2.sha256 + + - name: Compress image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu + gzip -v9 raspiblitz-amd64-debian-lean.qcow2 + + - name: Compute checksum of the compressed image + run: | + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu + sha256sum raspiblitz-amd64-debian-lean.qcow2.gz > raspiblitz-amd64-debian-lean.qcow2.gz.sha256 + + - name: Upload the image and checksums + uses: actions/upload-artifact@v3 + with: + name: raspiblitz-amd64-image-${{env.BUILD_DATE}}-${{env.BUILD_VERSION}} + path: | + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu/raspiblitz-amd64-debian-lean.qcow2.sha256 + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu/raspiblitz-amd64-debian-lean.qcow2.gz + ${{github.workspace}}/ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu/raspiblitz-amd64-debian-lean.qcow2.gz.sha256 diff --git a/.github/workflows/arm64-rpi-fatpack-image.yml b/.github/workflows/arm64-rpi-fatpack-image.yml new file mode 100644 index 000000000..a524a3dea --- /dev/null +++ b/.github/workflows/arm64-rpi-fatpack-image.yml @@ -0,0 +1,89 @@ +name: arm64-rpi-fatpack-image-build + +on: + workflow_dispatch: + #push: + # branches: [ "dev", "v1.8", "v1.9" ] + # paths: + # - 'build_sdcard.sh' + # - 'home.admin/bitcoin.install.sh' + # - 'home.admin/lnd.install.sh' + # - 'home.admin/cl.install.sh' + # - 'home.admin/cl-plugin.cln-grpc.sh' + # - 'home.admin/tor.install.sh' + # - 'home.admin/blitz.i2pd.sh' + # - 'home.admin/blitz.web.sh' + # - 'home.admin/bonus.nodejs.sh' + # - 'home.admin/bonus.rtl.sh' + # - 'home.admin/bonus.btcpayserver.sh' + # - 'home.admin/bonus.thunderhub.sh' + # - 'home.admin/bonus.jam.sh install' + # - 'home.admin/bonus.mempool.sh' + # - 'home.admin/blitz.web.api.sh' + # - 'home.admin/blitz.web.ui.sh' + # - 'home.admin/blitz.display.sh' + # - 'ci/arm64-rpi/**' + #pull_request: + # branches: [ "dev", "v1.8", "v1.9" ] + # paths: + # - 'build_sdcard.sh' + # - 'home.admin/bitcoin.install.sh' + # - 'home.admin/lnd.install.sh' + # - 'home.admin/cl.install.sh' + # - 'home.admin/cl-plugin.cln-grpc.sh' + # - 'home.admin/tor.install.sh' + # - 'home.admin/blitz.i2pd.sh' + # - 'home.admin/blitz.web.sh' + # - 'home.admin/bonus.nodejs.sh' + # - 'home.admin/bonus.rtl.sh' + # - 'home.admin/bonus.btcpayserver.sh' + # - 'home.admin/bonus.thunderhub.sh' + # - 'home.admin/bonus.jam.sh install' + # - 'home.admin/bonus.mempool.sh' + # - 'home.admin/blitz.web.api.sh' + # - 'home.admin/blitz.web.ui.sh' + # - 'home.admin/blitz.display.sh' + # - 'ci/arm64-rpi/**' + +jobs: + arm64-rpi-image-build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set values + run: | + echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV + echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + + - name: Hello Raspiblitz + run: echo "Building the raspiblitz-arm64-rpi-fatpack-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}" + + - name: Run the build script + run: | + cd ci/arm64-rpi + bash packer.build.arm64-rpi.sh fatpack $GITHUB_ACTOR $GITHUB_HEAD_REF + + - name: Compute checksum of the raw image + run: | + cd ci/arm64-rpi + sha256sum raspiblitz-arm64-rpi-fatpack.img > raspiblitz-arm64-rpi-fatpack.img.sha256 + + - name: Compress image + run: | + cd ci/arm64-rpi + gzip -v9 raspiblitz-arm64-rpi-fatpack.img + + - name: Compute checksum of the compressed image + run: | + cd ci/arm64-rpi + sha256sum raspiblitz-arm64-rpi-fatpack.img.gz > raspiblitz-arm64-rpi-fatpack.img.gz.sha256 + + - name: Upload the image and checksums + uses: actions/upload-artifact@v3 + with: + name: raspiblitz-arm64-fatpack-rpi-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }} + path: | + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-fatpack.img.sha256 + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-fatpack.img.gz + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-fatpack.img.gz.sha256 diff --git a/.github/workflows/arm64-rpi-lean-image.yml b/.github/workflows/arm64-rpi-lean-image.yml new file mode 100644 index 000000000..ef1f0d5f4 --- /dev/null +++ b/.github/workflows/arm64-rpi-lean-image.yml @@ -0,0 +1,67 @@ +name: arm64-rpi-lean-image-build + +on: + workflow_dispatch: + push: + branches: [ "dev", "v1.8", "v1.9" ] + paths: + - 'build_sdcard.sh' + - 'home.admin/bitcoin.install.sh' + - 'home.admin/tor.install.sh' + - 'home.admin/blitz.i2pd.sh' + - 'home.admin/blitz.web.sh' + - 'home.admin/blitz.display.sh' + - 'ci/arm64-rpi/**' + pull_request: + branches: [ "dev", "v1.8", "v1.9" ] + paths: + - 'build_sdcard.sh' + - 'home.admin/bitcoin.install.sh' + - 'home.admin/tor.install.sh' + - 'home.admin/blitz.i2pd.sh' + - 'home.admin/blitz.web.sh' + - 'home.admin/blitz.display.sh' + - 'ci/arm64-rpi/**' + +jobs: + arm64-rpi-image-build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set values + run: | + echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV + echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + + - name: Hello Raspiblitz + run: echo "Building the raspiblitz-arm64-rpi-lean-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}" + + - name: Run the build script + run: | + cd ci/arm64-rpi + bash packer.build.arm64-rpi.sh lean $GITHUB_ACTOR $GITHUB_HEAD_REF + + - name: Compute checksum of the raw image + run: | + cd ci/arm64-rpi + sha256sum raspiblitz-arm64-rpi-lean.img > raspiblitz-arm64-rpi-lean.img.sha256 + + - name: Compress image + run: | + cd ci/arm64-rpi + gzip -v9 raspiblitz-arm64-rpi-lean.img + + - name: Compute checksum of the compressed image + run: | + cd ci/arm64-rpi + sha256sum raspiblitz-arm64-rpi-lean.img.gz > raspiblitz-arm64-rpi-lean.img.gz.sha256 + + - name: Upload the image and checksums + uses: actions/upload-artifact@v3 + with: + name: raspiblitz-arm64-rpi-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }} + path: | + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.sha256 + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz + ${{ github.workspace }}/ci/arm64-rpi/raspiblitz-arm64-rpi-lean.img.gz.sha256 diff --git a/.gitignore b/.gitignore index c9e4a7a5e..bd8d9ea68 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ __pycache__ lightning_pb2.pyc lightning_pb2_grpc.pyc /.vagrant/ +ci/amd64/builds +ci/arm64-rpi/raspiblitz-arm64-rpi* +ci/arm64-rpi/.packer* +ci/arm64-rpi/packer-builder-arm diff --git a/CHANGES.md b/CHANGES.md index 090b8d4df..73ed899d4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,8 @@ ## What's new in Version 1.9.0 of RaspiBlitz? -- New: CL Watchtower (The Eye of Satoshi) [details](https://github.com/talaia-labs/rust-teos/tree/master/watchtower-plugin) +- New: Automated disk image build for amd64 (VM, laptop, desktop, server) and arm64-rpi (Raspberry Pi) [details](https://github.com/rootzoll/raspiblitz/tree/dev/ci/README.md) +- New: CLN Watchtower (The Eye of Satoshi) [details](https://github.com/talaia-labs/rust-teos/tree/master/watchtower-plugin) - New: LNDg v1.4.0 [details](https://github.com/cryptosharks131/lndg) - New: Support of X708 UPS HAT [details](https://github.com/rootzoll/raspiblitz/pull/3087) - New: BOS Telegram Bot Support (see OPTIONS on LND Balance of Satoshis menu entry) @@ -21,10 +22,9 @@ - Update: Channel Tools (chantools) v0.10.5 [details](https://github.com/guggero/chantools/releases/tag/v0.10.5) - Update: JoinMarket v0.9.8 [details](https://github.com/JoinMarket-Org/joinmarket-clientserver/releases/tag/v0.9.8) - Update: JoininBox v0.7.4 [details](https://github.com/openoms/joininbox/releases/tag/v0.7.3) -- Update: Electrum Server in Rust (electrs) v0.9.9 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#099-jul-12-2022) - Update: Balance of Satoshis 13.6.0 (BOS) [details](https://github.com/alexbosworth/balanceofsatoshis/blob/master/CHANGELOG.md#1360) - Update: Circuitbreaker v0.3.2 [details](https://github.com/lightningequipment/circuitbreaker/blob/master/README.md) -- Fixed: SCB/Emergency-Backup to USB drive (now also with cln emergency file) +- Fixed: SCB/Emergency-Backup to USB drive (now also with CLN emergency.recover file) - Info: Run RaspiBlitz on Proxmox [details](https://github.com/rootzoll/raspiblitz/tree/dev/alternative.platforms/Proxmox) - Info: IP2Tor unavailable & deactivated in SSH menus [details](https://github.com/rootzoll/raspiblitz/issues/3417#issuecomment-1310303480) - Info: 32GB sdcard is now enforced (after being recommended since v1.5) diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..e50f48d11 --- /dev/null +++ b/Makefile @@ -0,0 +1,83 @@ +SHELL = /bin/bash +GITHUB_ACTOR = $(shell git remote -v | grep origin | head -1 | cut -d/ -f4) +GITHUB_HEAD_REF = $(shell git rev-parse --abbrev-ref HEAD) + +amd64-lean-image: + # Run the build script + cd ci/amd64 && \ + bash packer.build.amd64-debian.sh lean $(GITHUB_ACTOR) $(GITHUB_HEAD_REF) 0 + + # Compute the checksum of the qemu image + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu && \ + sha256sum raspiblitz-amd64-debian-lean.qcow2 > raspiblitz-amd64-debian-lean.qcow2.sha256 + + # Compress the image + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu && \ + gzip -v9 raspiblitz-amd64-debian-lean.qcow2 + + # Compute the checksum of the compressed image + cd ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu && \ + sha256sum raspiblitz-amd64-debian-lean.qcow2.gz > raspiblitz-amd64-debian-lean.qcow2.gz.sha256 + + # List the generated files + ls -lah ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu/raspiblitz-amd64-debian-lean.qcow2.* + +amd64-fatpack-image: + # Run the build script + cd ci/amd64 && \ + bash packer.build.amd64-debian.sh fatpack $(GITHUB_ACTOR) $(GITHUB_HEAD_REF) + + # Compute the checksum of the qemu image + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu && \ + sha256sum raspiblitz-amd64-debian-fatpack.qcow2 > raspiblitz-amd64-debian-fatpack.qcow2.sha256 + + # Compress the image + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu && \ + gzip -v9 raspiblitz-amd64-debian-fatpack.qcow2 + + # Compute the checksum of the compressed image + cd ci/amd64/builds/raspiblitz-amd64-debian-fatpack-qemu && \ + sha256sum raspiblitz-amd64-debian-fatpack.qcow2.gz > raspiblitz-amd64-debian-fatpack.qcow2.gz.sha256 + + # List the generated files + ls -lah ci/amd64/builds/raspiblitz-amd64-debian-lean-qemu/raspiblitz-amd64-debian-fatpack.qcow2.* + +arm64-rpi-lean-image: + # Run the build script + cd ci/arm64-rpi && \ + bash packer.build.arm64-rpi.local.sh lean $(GITHUB_ACTOR) $(GITHUB_HEAD_REF) + + # Compute the checksum of the raw image + cd ci/arm64-rpi/packer-builder-arm && \ + sha256sum raspiblitz-arm64-rpi-lean.img > raspiblitz-arm64-rpi-lean.img.sha256 + + # Compress the image + cd ci/arm64-rpi/packer-builder-arm && \ + gzip -v9 raspiblitz-arm64-rpi-lean.img + + # Compute the checksum of the compressed image + cd ci/arm64-rpi/packer-builder-arm && \ + sha256sum raspiblitz-arm64-rpi-lean.img.gz > raspiblitz-arm64-rpi-lean.img.gz.sha256 + + # List the generated files + ls -lah ci/arm64-rpi/packer-builder-arm/raspiblitz-arm64-rpi-lean.img.* + +arm64-rpi-fatpack-image: + # Run the build script + cd ci/arm64-rpi && \ + bash packer.build.arm64-rpi.local.sh fatpack $(GITHUB_ACTOR) $(GITHUB_HEAD_REF) + + # Compute the checksum of the raw image + cd ci/arm64-rpi/packer-builder-arm && \ + sha256sum raspiblitz-arm64-rpi-fatpack.img > raspiblitz-arm64-rpi-fatpack.img.sha256 + + # Compress the image + cd ci/arm64-rpi/packer-builder-arm && \ + gzip -v9 raspiblitz-arm64-rpi-fatpack.img + + # Compute the checksum of the compressed image + cd ci/arm64-rpi/packer-builder-arm && \ + sha256sum raspiblitz-arm64-rpi-fatpack.img.gz > raspiblitz-arm64-rpi-fatpack.img.gz.sha256 + + # List the generated files + ls -lah ci/arm64-rpi/packer-builder-arm/raspiblitz-arm64-rpi-fatpack.img.* diff --git a/alternative.platforms/README.md b/alternative.platforms/README.md index ba5de52c5..6ada47bfb 100644 --- a/alternative.platforms/README.md +++ b/alternative.platforms/README.md @@ -4,11 +4,7 @@ - [Recommended specs](#recommended-specs) - [amd64 image](#amd64-image) - [Requirements](#requirements) - - [Download](#download) - - [Verify](#verify) - - [Write the image to the OS disk](#write-the-image-to-the-os-disk) - - [Extend the partition](#extend-the-partition) - - [Start the Raspiblitz setup](#start-the-raspiblitz-setup) + - [Automated builds](#automated-builds) - [Virtual Machine](#virtual-machine) - [Create the base image](#create-the-base-image) - [Building the Raspiblitz scripts](#building-the-raspiblitz-scripts) @@ -17,7 +13,7 @@ - [Armbian](#armbian) - [Ubuntu](#ubuntu) - [Python upgrade](#python-upgrade) -- [Create an image release for amd64](#create-an-image-release-for-amd64) +- [Manual image release for amd64](#manual-image-release-for-amd64) - [Requirements:](#requirements-1) - [Create an NTFS formatted USB Stick / USB disk](#create-an-ntfs-formatted-usb-stick--usb-disk) - [Boot Ubuntu Live from USB](#boot-ubuntu-live-from-usb) @@ -30,10 +26,9 @@ - [Start Tails](#start-tails) - [Import the signing keys](#import-the-signing-keys) - [Prepare the disk](#prepare-the-disk) -- [Verify the downloaded image](#verify-the-downloaded-image) - - [Linux instructions](#linux-instructions) -- [Create a torrent](#create-a-torrent) -- [Switch off sleep, suspend and hibernation](#switch-off-sleep-suspend-and-hibernation) + - [Verify the downloaded image](#verify-the-downloaded-image) + - [Linux instructions](#linux-instructions) + - [Create a torrent](#create-a-torrent) ## Minimum requirements * ARMv8 or x86 processor (64 bit) @@ -51,7 +46,6 @@ Specifications of the tested hardware: [hw_comparison.md](hw_comparison.md) All testers are welcome. Open an issue for your specific board to collaborate and share your experience. ## amd64 image - ### Requirements * amd64 Laptop, Desktop or Server connected to the internet via a LAN cable @@ -61,35 +55,8 @@ All testers are welcome. Open an issue for your specific board to collaborate an * if the laptop has an optical drive an [Optical Drive Bay Caddy / adapter](https://www.amazon.co.uk/dp/B07SHSCVC7/) can be used to change it to a second SSD instead. * `Data disk`: a new, minimum 1TB SSD is recommended - stores data independent of the operating system * usually placed internally - - -### Download - * raspiblitz-amd64-v1.7.2-2022-04-03 - * manually created with the [process described below](#Create-an-image-release-for-amd64) from the [`dev` branch](https://github.com/rootzoll/raspiblitz/tree/dev) at [43c7384](https://github.com/rootzoll/raspiblitz/tree/43c7384cb70523c57990e0c409d51cfd7b818a10) - * Torrent [file](/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.torrent) and [magnet link](/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.magnet) - * Direct downloads: - * https://mega.nz/folder/AlsC0A4L#mTPOke2OLJIGU4iMyAqwBw - * https://keybase.pub/oms/images/raspiblitz-amd64-v1.7.2-2022-04-03 - ``` - # download from keybase using the command line - mkdir raspiblitz-amd64-v1.7.2-2022-04-03 - cd raspiblitz-amd64-v1.7.2-2022-04-03 - wget -c https://oms.keybase.pub/images/raspiblitz-amd64-v1.7.2-2022-04-03/raspiblitz-amd64-v1.7.2-2022-04-03.img.gz - wget -c https://oms.keybase.pub/images/raspiblitz-amd64-v1.7.2-2022-04-03/raspiblitz-amd64-v1.7.2-2022-04-03.img.gz.sha256 - wget -c https://oms.keybase.pub/images/raspiblitz-amd64-v1.7.2-2022-04-03/raspiblitz-amd64-v1.7.2-2022-04-03.img.gz.sha256.asc - ``` - -### [Verify](#Verify-the-downloaded-image) -### Write the image to the OS disk -* On a separate computer: write the image to the USB connected OSdisk or SDcard with [Balena Etcher](https://www.balena.io/etcher/) -* On the same computer: boot an Ubuntu Live from USB with which the image can be downloaded, verified and flashed on an internal or USB connected OS disk -### Extend the partition -* start Disks or any partition manager and extend the partition to the full size of the disk on the OS disk (just flashed) - -### Start the Raspiblitz setup -* Assemble and start the computer. -* Log in with admin and open a terminal on the local desktop or log in with ssh (username `admin` password: `raspiblitz`) -* Continue the setup as described in the [main readme](https://github.com/rootzoll/raspiblitz#setup-process-detailed-documentation) +### Automated builds +* find the download links or build locally with the instructions in: [/ci/README.md](/ci/README.md) ## Virtual Machine @@ -233,7 +200,7 @@ Continue with building the SDcard: https://github.com/rootzoll/raspiblitz#build- python3 --version ``` -## Create an image release for amd64 +## Manual image release for amd64 Work notes partially based on: https://github.com/rootzoll/raspiblitz/blob/v1.7/FAQ.md#what-is-the-process-of-creating-a-new-sd-card-image-release @@ -386,8 +353,8 @@ Work notes partially based on: https://github.com/rootzoll/raspiblitz/blob/v1.7/ * Upload the new image to server - put the .sig file and .sha256 next to it * Copy the sha256sum to GitHub README and update the download link -## Verify the downloaded image -### Linux instructions +### Verify the downloaded image +#### Linux instructions * Open a terminal in the directory with the downloaded files ``` raspiblitz-amd64-vX.X.X-YEAR-MONTH-DAY.img.gz @@ -416,7 +383,7 @@ Work notes partially based on: https://github.com/rootzoll/raspiblitz/blob/v1.7/ # raspiblitz-amd64-vX.X.X-YEAR-MONTH-DAY.img.gz: OK ``` -## Create a torrent +### Create a torrent * Create Torrent file from image (for example with Transmission / qbBittorrent) and place in the `home.admin/assets` folder & link on README * Tracker list recommended to be used with the torrent: ``` @@ -449,8 +416,3 @@ Work notes partially based on: https://github.com/rootzoll/raspiblitz/blob/v1.7/ # Compare the sha256 hash to the hash of the image file (Look for the output 'OK'): shasum -c *.sha256 ``` -## Switch off sleep, suspend and hibernation -* Run in the terminal: - ``` - sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target - ``` diff --git a/build_sdcard.sh b/build_sdcard.sh index ccecb9f66..c704af40d 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -223,7 +223,7 @@ esac # AUTO-DETECTION: OPERATINGSYSTEM # --------------------------------------- if [ $(cat /etc/os-release 2>/dev/null | grep -c 'Debian') -gt 0 ]; then - if [ $(uname -n | grep -c 'raspberrypi') -gt 0 ] && [ "${cpu}" = aarch64 ]; then + if [ -f /etc/apt/sources.list.d/raspi.list ] && [ "${cpu}" = aarch64 ]; then # default image for RaspberryPi baseimage="raspios_arm64" elif [ $(uname -n | grep -c 'rpi') -gt 0 ] && [ "${cpu}" = aarch64 ]; then @@ -279,7 +279,7 @@ if [ "${baseimage}" = "raspios_arm64" ]||[ "${baseimage}" = "debian_rpi64" ]||[ fi echo "*** Remove unnecessary packages ***" -sudo apt remove --purge -y libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi plymouth python2 vlc cups +sudo apt remove --purge -y libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi plymouth python2 vlc* cups sudo apt clean -y sudo apt autoremove -y @@ -313,7 +313,9 @@ general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile b python_dependencies="python3-venv python3-dev python3-wheel python3-jinja2 python3-pip python3-mako" server_utils="rsync net-tools xxd netcat openssh-client openssh-sftp-server sshpass psmisc ufw sqlite3" [ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config -apt_install ${general_utils} ${python_dependencies} ${server_utils} ${armbian_dependencies} +[ "${architecture}" = "amd64" ] && amd64_dependencies="network-manager" # add amd64 dependency + +apt_install ${general_utils} ${python_dependencies} ${server_utils} ${armbian_dependencies} ${amd64_dependencies} sudo apt clean -y sudo apt autoremove -y @@ -775,7 +777,7 @@ if ${fatpack}; then sudo /home/admin/config.scripts/bonus.nodejs.sh on || exit 1 echo "* Optional Packages (may be needed for extended features)" - apt_install qrencode secure-delete fbi ssmtp unclutter xterm python3-pyqt5 xfonts-terminus apache2-utils nginx python3-jinja2 socat libatlas-base-dev hexyl autossh + apt_install qrencode secure-delete fbi msmtp unclutter xterm python3-pyqt5 xfonts-terminus apache2-utils nginx python3-jinja2 socat libatlas-base-dev hexyl autossh echo "* Adding LND ..." /home/admin/config.scripts/lnd.install.sh install || exit 1 @@ -792,20 +794,20 @@ if ${fatpack}; then # Fallback Nodes List from Bitcoin Core sudo -u admin curl https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/seeds/nodes_main.txt -o /home/admin/fallback.bitcoin.nodes - echo "* Adding Code&Compile for WEBUI-APP: RTL" - /home/admin/config.scripts/bonus.rtl.sh install || exit 1 - echo "* Adding Code&Compile for WEBUI-APP: BTCPAYSERVER" - /home/admin/config.scripts/bonus.btcpayserver.sh install || exit 1 - echo "* Adding Code&Compile for WEBUI-APP: MEMPOOL" - /home/admin/config.scripts/bonus.mempool.sh install || exit 1 - echo "* Adding Code&Compile for WEBUI-APP: THUNDERHUB" - /home/admin/config.scripts/bonus.thunderhub.sh install || exit 1 - echo "* Adding Code&Compile for WEBUI-APP: BTC RPC EXPLORER" - /home/admin/config.scripts/bonus.btc-rpc-explorer.sh install || exit 1 echo "* Adding Code&Compile for WEBUI-APP: LNBITS" /home/admin/config.scripts/bonus.lnbits.sh install || exit 1 echo "* Adding Code&Compile for WEBUI-APP: JAM" /home/admin/config.scripts/bonus.jam.sh install || exit 1 + echo "* Adding Code&Compile for WEBUI-APP: BTCPAYSERVER" + /home/admin/config.scripts/bonus.btcpayserver.sh install || exit 1 + echo "* Adding Code&Compile for WEBUI-APP: RTL" + /home/admin/config.scripts/bonus.rtl.sh install || exit 1 + echo "* Adding Code&Compile for WEBUI-APP: THUNDERHUB" + /home/admin/config.scripts/bonus.thunderhub.sh install || exit 1 + echo "* Adding Code&Compile for WEBUI-APP: BTC RPC EXPLORER" + /home/admin/config.scripts/bonus.btc-rpc-explorer.sh install || exit 1 + echo "* Adding Code&Compile for WEBUI-APP: MEMPOOL" + /home/admin/config.scripts/bonus.mempool.sh install || exit 1 echo "* Adding Raspiblitz API ..." sudo /home/admin/config.scripts/blitz.web.api.sh on "${defaultAPIuser}" "${defaultAPIrepo}" "blitz-${branch}" || exit 1 diff --git a/ci/README.md b/ci/README.md new file mode 100644 index 000000000..d8d69eee4 --- /dev/null +++ b/ci/README.md @@ -0,0 +1,202 @@ + +# Automated builds +* The images are built using the dev branch. +* The lean image has no Gnome desktop or WebUI installed. +* Issue: https://github.com/rootzoll/raspiblitz/issues/3053 +* The templates are made using: https://github.com/chef/bento + +- [Local build](#local-build) + - [Generate an arm64-rpi image](#generate-an-arm64-rpi-image) + - [Generate an amd64 image](#generate-an-amd64-image) +- [Images generated in github actions](#images-generated-in-github-actions) +- [Write the image to a disk connected with USB](#write-the-image-to-a-disk-connected-with-usb) + - [Convert the qcow2 volume to a raw disk image](#convert-the-qcow2-volume-to-a-raw-disk-image) + - [Write to a disk connected with USB with Balena Etcher or `dd`](#write-to-a-disk-connected-with-usb-with-balena-etcher-or-dd) + - [Extend the partition on the new disk (optional)](#extend-the-partition-on-the-new-disk-optional) +- [The first boot](#the-first-boot) + - [fatpack image](#fatpack-image) + - [lean image](#lean-image) + - [Add Gnome desktop (optional)](#add-gnome-desktop-optional) +- [Add wifi](#add-wifi) +- [Add wifi driver (optional)](#add-wifi-driver-optional) +- [Workflow notes](#workflow-notes) + - [Packer .json settings:](#packer-json-settings) + - [VNC](#vnc) + - [Flashing](#flashing) + +## Local build +with the [Makefile](https://github.com/rootzoll/raspiblitz/blob/dev/Makefile) +* needs ~20 GB free space +* tested on: + * Ubuntu Live (jammy) + * Debian Bullseye Desktop +* Preparation: + ``` + # change to a mountpoint with sufficient space (check with 'df -h') + cd /var/log + # switch to root + sudo su + # install git and make + apt update && apt install -y git make + # download the repo (or your fork) + git clone https://github.com/rootzoll/raspiblitz + cd raspiblitz + # checkout the desired branch + git checkout dev + ``` + +### Generate an arm64-rpi image +* The workflow locally and in github actions generates a .img raw format image for the Raspberry Pi. + ``` + make arm-rpi-lean-image + ``` +* find the image and sh256 hashes in the `ci/arm64-rpi/packer-builder-arm` directory +* the .img.gz file can be written to an SDcard directly with Balena Etcher + +### Generate an amd64 image +The workflow locally and in github actions generates a .qcow2 format amd64 image. +* Tested with + * libvirt / virsh / virt-manager (https://virt-manager.org/) + * written to disk and booted with legacy boot (non-UEFI) + ``` + make amd64-lean-image + ``` +* find the compressed .qcow2 image and sh256 hashes in the `ci/amd64/builds` directory + +## Images generated in github actions +* Find the images in the green runs in github actions at: +https://github.com/rootzoll/raspiblitz/actions + + ``` + # unzip to the same directory + unzip raspiblitz-amd64-image-YEAR-MM-DD-COMMITHASH.zip + ``` +## Write the image to a disk connected with USB +identify the connected disk with `lsblk` eg `/dev/sdd` + +### Convert the qcow2 volume to a raw disk image +* the raw image is 33.5 GB + ``` + # unzip + gzip -dkv raspiblitz-amd64-debian-11.5-lean.qcow2.gz + # convert + qemu-img convert raspiblitz-amd64-debian-11.5-lean.qcow2 raspiblitz-amd64-debian-11.5-lean.img + ``` +### Write to a disk connected with USB with Balena Etcher or `dd` +* [Balena Etcher](https://www.balena.io/etcher/) to write the .img to disk +* dd to write the .img to disk + ``` + # identify partitions + lsblk + # write to disk + sudo dd if=./raspiblitz-amd64-debian-11.5-lean.img of=/dev/sde bs=4M status=progress + ``` + +* qemu-image dd to write the .qcow2 directly to disk + ``` + sudo apt install -y qemu-utils + sudo qemu-img dd if=./raspiblitz-amd64-debian-11.5-lean.qcow2 of=/dev/sde bs=4M + ``` +### Extend the partition on the new disk (optional) +* Use Disks to resize the Extended Partition to the full size of the disk +* To extend the LVM: + ``` + # identify the USB connected disk + lsblk + df -h + # extend the lvm to the full free space and resize the filesystem + sudo lvextend -r -l +100%FREE /dev/mapper/raspiblitz--amd74--debian--11--vg-root + + # alternatively download the script + git clone https://git.scs.carleton.ca/git/extend-lvm.git + # run with the disk as the parameter (sde for example) + sudo bash extend-lvm/extend-lvm.sh /dev/sde + ``` + +## The first boot +### fatpack image +* log in on screen: + * username: `admin` + * password: `raspiblitz` + +* start a terminal for guidance + +* alternatively open a browser and go to: + * http://localhost +* can also open the WebUI on another computer + * Find the the RaspiBlitz_IP in your router dashboard, in the terminal prompt or with `hostname -I` + * open: http://RaspiBlitz_IP + +### lean image +* press any key to get to a login prompt after the splash screen + * username: `admin` + * password: `raspiblitz` + +#### Add Gnome desktop (optional) +* Connect to the internet (easiest to plug in a LAN cable - use a USB - LAN adapter if have no port) + ``` + apt install gnome + systemctl start gdm + ``` + +## Add wifi +* if the wifi driver is included in the FOSS Debian distro +* in the command line run the network manager interface to connect: + ``` + sudo nmtui + ``` +## Add wifi driver (optional) +* as in https://wiki.debian.org/iwlwifi +* add the component `non-free` after `deb http://deb.debian.org/debian bullseye main` in `/etc/apt/sources.list` +* install the wifi driver for the mentioned cards: + ``` + sudo apt update && sudo apt install firmware-iwlwifi + ``` + +## Workflow notes + +The github workflow files are the equivalent of the Makefile commands run locally. +The local repo owner (`GITHUB_ACTOR`) and branch (`GITHUB_HEAD_REF`) is picked up. +The build_sdcard.sh is downloaded from the source branch and built with the options pack=[lean|fatpack] to set fatpack=[0|1]. + +The github workflow is running the job in an ubuntu-22.04 image. + +The amd64 image is built with running a qemu VM +* installs the base OS (Debian 11.5) +* connects with ssh and runs the scripts including the build_sdcard.sh + +The arm64-rpi image genenaration runs in Docker in github actions and without Docker locally. +* the base image (RasberryOS) is started in the qemu VM +* packer runs the build_sdcard.sh directly in the VM + +After the image is built (and there is no exit with errors) the next steps are: +* compute checksum of the qemu/raw image +* compress the image with gzip +* compute checksum of the compressed image +* (in github actions: upload the artifacts in one .zip file) + +### Packer .json settings: +* `disk_size` - the size op the raw image. The .qcow2 file is compressed. +* `template` - image filename +* `output_directory` - directory under builds where the image will be placed +* the `pi` user is given passwordless sudo access and used for the image setup +* use `file_checksum` instead of `file_checksum_url`. The image must be downloaded and verified with PGP manually to fill the field: + ``` + # image + wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64.img.xz + # signature + wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64.img.xz.sig + # hash + wget https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64.img.xz.sha256 + + curl https://www.raspberrypi.org/raspberrypi_downloads.gpg.key | gpg --import + + sha256sum -c 2022-09-22-raspios-bullseye-arm64.img.xz.sha256 && \ + gpg --verify 2022-09-22-raspios-bullseye-arm64.img.xz.sig + + cat 2022-09-22-raspios-bullseye-arm64.img.xz.sha256 + ``` +### VNC +* can follow the setup locally in VNC with the port stated in the first part of the logs eg: `Found available VNC port: 5952 on IP: 127.0.0.1` +### Flashing +* using `qemu-img dd bs=4M if=raspiblitz-amd64-debian-11.5-lean.qcow2 of=/dev/sdd` changed the UUID so it won't boot without editing GRUB diff --git a/ci/amd64/_common/sshd.sh b/ci/amd64/_common/sshd.sh new file mode 100644 index 000000000..1bb16f56e --- /dev/null +++ b/ci/amd64/_common/sshd.sh @@ -0,0 +1,20 @@ +#!/bin/sh -eux + +SSHD_CONFIG="/etc/ssh/sshd_config" + +# ensure that there is a trailing newline before attempting to concatenate +sed -i -e '$a\' "$SSHD_CONFIG" + +USEDNS="UseDNS no" +if grep -q -E "^[[:space:]]*UseDNS" "$SSHD_CONFIG"; then + sed -i "s/^\s*UseDNS.*/${USEDNS}/" "$SSHD_CONFIG" +else + echo "$USEDNS" >>"$SSHD_CONFIG" +fi + +GSSAPI="GSSAPIAuthentication no" +if grep -q -E "^[[:space:]]*GSSAPIAuthentication" "$SSHD_CONFIG"; then + sed -i "s/^\s*GSSAPIAuthentication.*/${GSSAPI}/" "$SSHD_CONFIG" +else + echo "$GSSAPI" >>"$SSHD_CONFIG" +fi diff --git a/ci/amd64/debian/amd64-debian.json b/ci/amd64/debian/amd64-debian.json new file mode 100644 index 000000000..f358d9b28 --- /dev/null +++ b/ci/amd64/debian/amd64-debian.json @@ -0,0 +1,81 @@ +{ + "variables": { + "box_basename": "debian", + "build_directory": "../builds", + "build_timestamp": "{{isotime \"20060102150405\"}}", + "pack": "{{user `pack`}}", + "cpus": "4", + "disk_size": "30000", + "git_revision": "__unknown_git_revision__", + "guest_additions_url": "", + "headless": "false", + "http_directory": "{{template_dir}}/http", + "http_proxy": "{{env `http_proxy`}}", + "https_proxy": "{{env `https_proxy`}}", + "iso_checksum": "e482910626b30f9a7de9b0cc142c3d4a079fbfa96110083be1d0b473671ce08d", + "iso_name": "debian-11.6.0-amd64-netinst.iso", + "memory": "4096", + "mirror": "http://cdimage.debian.org/cdimage/release", + "mirror_directory": "current/amd64/iso-cd", + "name": "debian", + "no_proxy": "{{env `no_proxy`}}", + "preseed_path": "debian-9/preseed.cfg", + "qemu_display": "none", + "qemu_bios": "bios-256k.bin", + "template": "raspiblitz-amd64-debian-{{user `pack`}}", + "boot_command": "install preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `preseed_path`}} debian-installer=en_US.UTF-8 auto locale=en_US.UTF-8 kbd-chooser/method=us keyboard-configuration/xkb-keymap=us netcfg/get_hostname={{ .Name }} netcfg/get_domain=vagrantup.com fb=false debconf/frontend=noninteractive console-setup/ask_detect=false console-keymaps-at/keymap=us grub-installer/bootdev=default ", + "version": "TIMESTAMP" +}, + "builders": [ + { + "boot_command": "{{user `boot_command`}}", + "boot_wait": "5s", + "cpus": "{{ user `cpus` }}", + "disk_size": "{{user `disk_size`}}", + "headless": "{{ user `headless` }}", + "http_directory": "{{user `http_directory`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "memory": "{{ user `memory` }}", + "output_directory": "{{ user `build_directory` }}/{{user `template`}}-qemu", + "shutdown_command": "echo 'raspiblitz' | sudo /sbin/shutdown -hP now", + "ssh_password": "raspiblitz", + "ssh_port": 22, + "ssh_timeout": "10000s", + "ssh_username": "pi", + "type": "qemu", + "format": "qcow2", + "vm_name": "{{ user `template` }}.qcow2", + "qemuargs": [ + [ "-m", "{{ user `memory` }}" ], + [ "-bios", "{{ user `qemu_bios` }}" ], + [ "-display", "{{ user `qemu_display` }}" ] + ] + } + ], + "provisioners": [ + { + "type": "shell", + "environment_vars": [ + "HOME_DIR=/home/pi", + "http_proxy={{user `http_proxy`}}", + "https_proxy={{user `https_proxy`}}", + "no_proxy={{user `no_proxy`}}", + "github_user={{user `github_user`}}", + "branch={{user `branch`}}", + "pack={{user `pack`}}" + ], + "execute_command": "echo 'raspiblitz' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'", + "expect_disconnect": true, + "scripts": [ + "{{template_dir}}/scripts/update.sh", + "{{template_dir}}/../_common/sshd.sh", + "{{template_dir}}/scripts/networking.sh", + "{{template_dir}}/scripts/sudoers.sh", + "{{template_dir}}/scripts/systemd.sh", + "{{template_dir}}/scripts/raspiblitz.sh", + "{{template_dir}}/scripts/cleanup.sh" + ] + } + ] +} diff --git a/ci/amd64/debian/http/debian-9/preseed.cfg b/ci/amd64/debian/http/debian-9/preseed.cfg new file mode 100644 index 000000000..7ab0c3414 --- /dev/null +++ b/ci/amd64/debian/http/debian-9/preseed.cfg @@ -0,0 +1,47 @@ +choose-mirror-bin mirror/http/proxy string +d-i apt-setup/use_mirror boolean true +d-i base-installer/kernel/override-image string linux-server +d-i clock-setup/utc boolean true +d-i clock-setup/utc-auto boolean true +d-i finish-install/reboot_in_progress note +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i keymap select us +d-i mirror/country string manual +d-i mirror/http/directory string /debian +d-i mirror/http/hostname string httpredir.debian.org +d-i mirror/http/proxy string +d-i partman-auto-lvm/guided_size string max +d-i partman-auto/choose_recipe select atomic +d-i partman-auto/method string lvm +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/confirm_write_new_label boolean true +d-i passwd/root-login boolean false +d-i passwd/root-password-again password raspiblitz +d-i passwd/root-password password raspiblitz +d-i passwd/user-fullname string pi +d-i passwd/user-uid string 1000 +d-i passwd/user-password password raspiblitz +d-i passwd/user-password-again password raspiblitz +d-i passwd/username string pi +d-i pkgsel/include string sudo bzip2 acpid cryptsetup zlib1g-dev wget curl dkms fuse make nfs-common net-tools cifs-utils rsync +d-i pkgsel/install-language-support boolean false +d-i pkgsel/update-policy select none +d-i pkgsel/upgrade select full-upgrade +# Prevent packaged version of VirtualBox Guest Additions being installed: +d-i preseed/early_command string sed -i \ + '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \ + /usr/lib/pre-pkgsel.d/20install-hwpackages +d-i time/zone string UTC +d-i user-setup/allow-password-weak boolean true +d-i user-setup/encrypt-home boolean false +d-i preseed/late_command string sed -i '/^deb cdrom:/s/^/#/' /target/etc/apt/sources.list +apt-cdrom-setup apt-setup/cdrom/set-first boolean false +apt-mirror-setup apt-setup/use_mirror boolean true +popularity-contest popularity-contest/participate boolean false +tasksel tasksel/first multiselect standard, ssh-server diff --git a/ci/amd64/debian/scripts/cleanup.sh b/ci/amd64/debian/scripts/cleanup.sh new file mode 100644 index 000000000..c9b09d0be --- /dev/null +++ b/ci/amd64/debian/scripts/cleanup.sh @@ -0,0 +1,55 @@ +#!/bin/sh -eux + +echo "remove linux-headers" +dpkg --list \ + | awk '{ print $2 }' \ + | grep 'linux-headers' \ + | xargs apt-get -y purge; + +echo "remove specific Linux kernels, such as linux-image-4.9.0-13-amd64 but keeps the current kernel and does not touch the virtual packages" +dpkg --list \ + | awk '{ print $2 }' \ + | grep 'linux-image-[234].*' \ + | grep -v `uname -r` \ + | xargs apt-get -y purge; + +echo "remove linux-source package" +dpkg --list \ + | awk '{ print $2 }' \ + | grep linux-source \ + | xargs apt-get -y purge; + +echo "remove obsolete networking packages" +apt-get -y purge ppp pppconfig pppoeconf; + +echo "remove popularity-contest package" +apt-get -y purge popularity-contest; + +echo "remove installation-report package" +apt-get -y purge installation-report; + +echo "autoremoving packages and cleaning apt data" +apt-get -y autoremove; +apt-get -y clean; + +echo "remove /var/cache" +find /var/cache -type f -exec rm -rf {} \; + +echo "truncate any logs that have built up during the install" +find /var/log -type f -exec truncate --size=0 {} \; + +echo "blank netplan machine-id (DUID) so machines get unique ID generated on boot" +truncate -s 0 /etc/machine-id + +echo "remove the contents of /tmp and /var/tmp" +rm -rf /tmp/* /var/tmp/* + +echo "force a new random seed to be generated" +rm -f /var/lib/systemd/random-seed + +echo "delete the SSH keys (will be recreated on the first boot)" +rm -f /etc/ssh/ssh_host_* + +echo "clear the history so our install isn't there" +rm -f /root/.wget-hsts +export HISTSIZE=0 diff --git a/ci/amd64/debian/scripts/networking.sh b/ci/amd64/debian/scripts/networking.sh new file mode 100644 index 000000000..a574c6900 --- /dev/null +++ b/ci/amd64/debian/scripts/networking.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eux + +# Disable Predictable Network Interface names and use eth0 +sed -i 's/en[[:alnum:]]*/eth0/g' /etc/network/interfaces; +sed -i 's/GRUB_CMDLINE_LINUX="\(.*\)"/GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 \1"/g' /etc/default/grub; +update-grub; + +# Adding a 2 sec delay to the interface up, to make the dhclient happy +echo "pre-up sleep 2" >> /etc/network/interfaces diff --git a/ci/amd64/debian/scripts/raspiblitz.sh b/ci/amd64/debian/scripts/raspiblitz.sh new file mode 100644 index 000000000..4d6cc31e6 --- /dev/null +++ b/ci/amd64/debian/scripts/raspiblitz.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eux + +echo 'Download the build_sdcard.sh script ...' +wget https://raw.githubusercontent.com/${github_user}/raspiblitz/${branch}/build_sdcard.sh + +if [ ${pack} = "fatpack" ]; then + fatpack="1" +else + fatpack="0" +fi + +if [ "${fatpack}" = "1" ]; then + echo 'Add Gnome desktop' + export DEBIAN_FRONTEND=none + sudo apt install gnome -y +fi + +echo 'Build RaspiBlitz ...' +bash build_sdcard.sh -f ${fatpack} -u ${github_user} -b ${branch} -d headless -t false -w off -i false diff --git a/ci/amd64/debian/scripts/sudoers.sh b/ci/amd64/debian/scripts/sudoers.sh new file mode 100644 index 000000000..4bf421817 --- /dev/null +++ b/ci/amd64/debian/scripts/sudoers.sh @@ -0,0 +1,9 @@ +#!/bin/sh -eux + +# Only add the secure path line if it is not already present +grep -q 'secure_path' /etc/sudoers \ + || sed -i -e '/Defaults\s\+env_reset/a Defaults\tsecure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' /etc/sudoers; + +# Set up password-less sudo for the pi user +echo 'pi ALL=(ALL) NOPASSWD:ALL' >/etc/sudoers.d/99_pi; +chmod 440 /etc/sudoers.d/99_pi; diff --git a/ci/amd64/debian/scripts/systemd.sh b/ci/amd64/debian/scripts/systemd.sh new file mode 100644 index 000000000..2d1b5a71e --- /dev/null +++ b/ci/amd64/debian/scripts/systemd.sh @@ -0,0 +1,4 @@ +#!/bin/sh -eux + +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751636 +apt-get install libpam-systemd diff --git a/ci/amd64/debian/scripts/update.sh b/ci/amd64/debian/scripts/update.sh new file mode 100644 index 000000000..c657200a7 --- /dev/null +++ b/ci/amd64/debian/scripts/update.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eux + +arch="$(uname -r | sed 's/^.*[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\(-[0-9]\{1,2\}\)-//')" +debian_version="$(lsb_release -r | awk '{print $2}')" +major_version="$(echo $debian_version | awk -F. '{print $1}')" + +# Disable systemd apt timers/services +systemctl stop apt-daily.timer +systemctl stop apt-daily-upgrade.timer +systemctl disable apt-daily.timer +systemctl disable apt-daily-upgrade.timer +systemctl mask apt-daily.service +systemctl mask apt-daily-upgrade.service +systemctl daemon-reload + +## leave update and upgrade to the build_sdcard.sh +#apt-get update +#apt-get -y upgrade linux-image-$arch +#apt-get -y install linux-headers-$(uname -r) diff --git a/ci/amd64/packer.build.amd64-debian.sh b/ci/amd64/packer.build.amd64-debian.sh new file mode 100644 index 000000000..37d2868c1 --- /dev/null +++ b/ci/amd64/packer.build.amd64-debian.sh @@ -0,0 +1,37 @@ +#!/bin/bash -e + +# Install packer +curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - +sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +sudo apt-get update +echo -e "\nInstalling packer..." +sudo apt-get install -y packer + +# Install qemu +echo -e "\nInstalling qemu..." +sudo apt-get install -y qemu-system + +if [ $# -gt 0 ]; then + pack=$1 +else + pack=lean +fi + +if [ $# -gt 1 ]; then + github_user=$2 +else + github_user=rootzoll +fi + +if [ $# -gt 2 ]; then + branch=$3 +else + branch=dev +fi + +# Build the image +echo -e "\nBuilding image..." +cd debian +PACKER_LOG=1 packer build \ + --var pack=${pack} --var github_user=${github_user} --var branch=${branch} \ + -only=qemu amd64-debian.json diff --git a/ci/arm64-rpi/arm64-rpi.pkr.hcl b/ci/arm64-rpi/arm64-rpi.pkr.hcl new file mode 100644 index 000000000..d183cbda8 --- /dev/null +++ b/ci/arm64-rpi/arm64-rpi.pkr.hcl @@ -0,0 +1,66 @@ +variable "pack" {} +variable "github_user" {} +variable "branch" {} + +source "arm" "raspiblitz-arm64-rpi" { + file_checksum_type = "sha256" + file_checksum = "c42856ffca096480180b5aff66e1dad2f727fdc33359b24e0d2d49cc7676b576" + file_target_extension = "xz" + file_unarchive_cmd = ["xz", "--decompress", "$ARCHIVE_PATH"] + file_urls = ["https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64.img.xz"] + image_build_method = "resize" + image_chroot_env = ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"] + image_partitions { + filesystem = "vfat" + mountpoint = "/boot" + name = "boot" + size = "256M" + start_sector = "8192" + type = "c" + } + image_partitions { + filesystem = "ext4" + mountpoint = "/" + name = "root" + size = "0" + start_sector = "532480" + type = "83" + } + image_path = "raspiblitz-arm64-rpi-${var.pack}.img" + image_size = "30G" + image_type = "dos" + qemu_binary_destination_path = "/usr/bin/qemu-arm-static" + qemu_binary_source_path = "/usr/bin/qemu-arm-static" +} + +build { + sources = ["source.arm.raspiblitz-arm64-rpi"] + + provisioner "shell" { + inline = [ + "echo 'nameserver 1.1.1.1' > /etc/resolv.conf", + "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf", + "echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections", + "apt-get install -y sudo wget", + "apt-get -y autoremove", + "apt-get -y clean", + ] + } + + provisioner "shell" { + environment_vars = [ + "github_user=${var.github_user}", + "branch=${var.branch}", + "pack=${var.pack}" + ] + script = "./raspiblitz.sh" + } + + provisioner "shell" { + inline = [ + "echo '# delete the SSH keys (will be recreated on the first boot)'", + "rm -f /etc/ssh/ssh_host_*", + "echo 'OK'", + ] + } +} diff --git a/ci/arm64-rpi/packer.build.arm64-rpi.local.sh b/ci/arm64-rpi/packer.build.arm64-rpi.local.sh new file mode 100644 index 000000000..f64659773 --- /dev/null +++ b/ci/arm64-rpi/packer.build.arm64-rpi.local.sh @@ -0,0 +1,79 @@ +#!/bin/bash -e + +echo "\n# Install dependencies with apt" +if [ "$(uname -n)" = "ubuntu" ]; then + sudo add-apt-repository -y universe +fi + +# Install dependencies +# needed on Ubuntu Live ('lsb_release -cs': jammy) +sudo apt install -y qemu-user-static || exit 1 + +# from https://github.com/mkaczanowski/packer-builder-arm/blob/master/docker/Dockerfile +sudo apt install -y \ + wget \ + curl \ + ca-certificates \ + dosfstools \ + fdisk \ + gdisk \ + kpartx \ + libarchive-tools \ + parted \ + psmisc \ + qemu-utils \ + sudo \ + xz-utils || exit 1 + +echo -e "\n# Install Packer..." +if ! packer version 2>/dev/null; then + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - + sudo apt-add-repository -y "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" + sudo apt-get update -y && sudo apt-get install packer -y || exit 1 +else + echo "# Packer is installed" +fi + +echo -e "\n# Install Go" +export PATH=$PATH:/usr/local/go/bin +if ! go version 2>/dev/null | grep "1.18.9"; then + wget --progress=bar:force https://go.dev/dl/go1.18.9.linux-amd64.tar.gz + echo "015692d2a48e3496f1da3328cf33337c727c595011883f6fc74f9b5a9c86ffa8 go1.18.9.linux-amd64.tar.gz" | sha256sum -c - || exit 1 + sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.9.linux-amd64.tar.gz + sudo rm -rf go1.18.9.linux-amd64.tar.gz +else + echo "# Go 1.18.9 is installed" +fi + +echo -e "\n# Download the packer-builder-arm plugin" +git clone https://github.com/mkaczanowski/packer-builder-arm +cd packer-builder-arm +# pin to commit hash https://github.com/mkaczanowski/packer-builder-arm/commits/master +git reset --hard 6636c687ece53f7d1f5f2b35aa41f0e6132949c4 +echo -e "\n# Build the packer-builder-arm plugin" +go mod download +go build || exit 1 + +if [ $# -gt 0 ]; then + pack=$1 +else + pack=lean +fi + +if [ $# -gt 1 ]; then + github_user=$2 +else + github_user=rootzoll +fi + +if [ $# -gt 2 ]; then + branch=$3 +else + branch=dev +fi + +cp ../arm64-rpi.pkr.hcl ./ +cp ../raspiblitz.sh ./ + +echo -e "\n# Build the image" +packer build -var github_user=${github_user} -var branch=${branch} -var pack=${pack} arm64-rpi.pkr.hcl diff --git a/ci/arm64-rpi/packer.build.arm64-rpi.sh b/ci/arm64-rpi/packer.build.arm64-rpi.sh new file mode 100644 index 000000000..8e8436660 --- /dev/null +++ b/ci/arm64-rpi/packer.build.arm64-rpi.sh @@ -0,0 +1,26 @@ +#!/bin/bash -e + +if [ $# -gt 0 ]; then + pack=$1 +else + pack=lean +fi + +if [ $# -gt 1 ]; then + github_user=$2 +else + github_user=rootzoll +fi + +if [ $# -gt 2 ]; then + branch=$3 +else + branch=dev +fi + +# Build the image in docker +echo -e "\nBuild Packer image..." +# from https://hub.docker.com/r/mkaczanowski/packer-builder-arm/tags +docker run --rm --privileged -v /dev:/dev -v ${PWD}:/build \ + mkaczanowski/packer-builder-arm:1.0.5@sha256:a6371a3230b94c308e9a8cd55da1ae0d23bd670b7e558b39683c24f489d03e53 \ + build -var github_user=${github_user} -var branch=${branch} -var pack=${pack} arm64-rpi.pkr.hcl diff --git a/ci/arm64-rpi/raspiblitz.sh b/ci/arm64-rpi/raspiblitz.sh new file mode 100644 index 000000000..8ecee21f0 --- /dev/null +++ b/ci/arm64-rpi/raspiblitz.sh @@ -0,0 +1,15 @@ +#!/bin/sh -eux + +echo 'Download the build_sdcard.sh script ...' +wget https://raw.githubusercontent.com/${github_user}/raspiblitz/${branch}/build_sdcard.sh + +if [ "${pack}" = "fatpack" ]; then + fatpack="1" + # make /dev/shm world writable for qemu + sudo chmod 777 /dev/shm +else + fatpack="0" +fi + +echo 'Build RaspiBlitz ...' +bash build_sdcard.sh -f ${fatpack} -u ${github_user} -b ${branch} -d headless -t false -w off -i false diff --git a/home.admin/_cache.sh b/home.admin/_cache.sh index 96c8fb0d6..3c2ebb6b3 100755 --- a/home.admin/_cache.sh +++ b/home.admin/_cache.sh @@ -113,13 +113,13 @@ elif [ "$1" = "keyvalue" ] && [ "$2" = "on" ]; then sudo sed -i "/^save .*/d" /etc/redis/redis.conf # restart with new config - sudo systemctl restart redis-server + if ! ischroot; then sudo systemctl restart redis-server; fi # clean old databases if exist sudo rm /var/lib/redis/dump.rdb 2>/dev/null # restart again this time there is no old data dump to load - sudo systemctl restart redis-server + if ! ischroot; then sudo systemctl restart redis-server; fi # uninstall elif [ "$1" = "keyvalue" ] && [ "$2" = "off" ]; then diff --git a/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.magnet b/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.magnet deleted file mode 100644 index c5b2ad5b6..000000000 --- a/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.magnet +++ /dev/null @@ -1 +0,0 @@ -magnet:?xt=urn:btih:7885922bd94ccbed5572628931e8b2a5d5b7212a&dn=raspiblitz-amd64-v1.7.2-2022-04-03&tr=http%3a%2f%2ftracker.skyts.net%3a6969%2fannounce&tr=http%3a%2f%2ftracker.yoshi210.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.leechers-paradise.org%3a6969&tr=http%3a%2f%2ftracker2.itzmx.com%3a6961%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2780%2fannounce&tr=http%3a%2f%2fpow7.com%3a80%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.coppersurfer.tk%3a6969%2fannounce&tr=http%3a%2f%2fopen.acgtracker.com%3a1096%2fannounce \ No newline at end of file diff --git a/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.torrent b/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.torrent deleted file mode 100644 index 678f2cf8d..000000000 Binary files a/home.admin/assets/raspiblitz-amd64-v1.7.2-2022-04-03.torrent and /dev/null differ diff --git a/home.admin/config.scripts/blitz.i2pd.sh b/home.admin/config.scripts/blitz.i2pd.sh index 7210decea..5d403e5a3 100644 --- a/home.admin/config.scripts/blitz.i2pd.sh +++ b/home.admin/config.scripts/blitz.i2pd.sh @@ -111,6 +111,12 @@ function bitcoinI2Pstatus { echo "# Running: 'blitz.i2pd.sh $*'" source /mnt/hdd/raspiblitz.conf +# make sure to be present in PATH +if ! echo "$PATH" | grep "/usr/sbin"; then + export PATH=$PATH:/usr/sbin + echo "PATH=\$PATH:/usr/sbin" | sudo tee -a /etc/profile +fi + if [ "$1" = "install" ]; then isInstalled=$(sudo systemctl list-unit-files | grep -c i2pd) @@ -118,34 +124,12 @@ if [ "$1" = "install" ]; then echo "# i2pd is already installed." else echo "# Installing i2pd ..." - ARCHITECTURE=$(dpkg --print-architecture) - if [ ${ARCHITECTURE} = arm64 ]; then - # use the deb repo - add_repo + add_repo - sudo apt-get update - sudo apt-get install -y i2pd - else - # install from github - # https://github.com/PurpleI2P/i2pd/releases - VERSION=2.43.0 - DISTRO=$(lsb_release -cs) + sudo apt-get update + sudo apt-get install -y i2pd - mkdir -p download/i2pd - cd download/i2pd || exit 1 - wget -O i2pd_${VERSION}-1${DISTRO}1_${ARCHITECTURE}.deb https://github.com/PurpleI2P/i2pd/releases/download/${VERSION}/i2pd_${VERSION}-1${DISTRO}1_${ARCHITECTURE}.deb - - # verify - wget -O SHA512SUMS https://github.com/PurpleI2P/i2pd/releases/download/${VERSION}/SHA512SUMS - wget -O SHA512SUMS.asc https://github.com/PurpleI2P/i2pd/releases/download/${VERSION}/SHA512SUMS.asc - curl https://repo.i2pd.xyz/r4sas.gpg | gpg --import - gpg --verify SHA512SUMS.asc || (echo "# PGP signature error"; exit 5) - sha512sum -c SHA512SUMS --ignore-missing || (echo "# Checksum error"; exit 6) - - # install - sudo dpkg -i --force-confnew i2pd_${VERSION}-1${DISTRO}1_${ARCHITECTURE}.deb - fi fi exit 0 fi