diff --git a/.github/workflows/amd64-image-build.yml b/.github/workflows/amd64-image-build.yml index f8ff37a..f0524bc 100644 --- a/.github/workflows/amd64-image-build.yml +++ b/.github/workflows/amd64-image-build.yml @@ -26,17 +26,24 @@ jobs: - uses: actions/checkout@v3 - name: Set values + id: set_values run: | echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + if [[ "${{github.event_name}}" == "pull_request" ]]; then + echo "::set-output name=github_user::${{github.event.pull_request.head.repo.owner.login}}" + else + echo "::set-output name=github_user::$(echo ${{github.repository}} | cut -d'/' -f1)" + fi - - name: Hello JoininBox + - name: Display the build name run: echo "Building the joininbox-amd64-debian-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}" - name: Run the build script run: | + echo "Running with: ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF" cd ci/amd64 - bash packer.build.amd64-debian.sh $GITHUB_ACTOR $GITHUB_HEAD_REF + bash packer.build.amd64-debian.sh ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF - name: Compute checksum of the raw image run: | diff --git a/.github/workflows/arm64-rpi-image-build.yml b/.github/workflows/arm64-rpi-image-build.yml index 6d2c1f5..66640fb 100644 --- a/.github/workflows/arm64-rpi-image-build.yml +++ b/.github/workflows/arm64-rpi-image-build.yml @@ -28,11 +28,17 @@ jobs: - uses: actions/checkout@v3 - name: Set values + id: set_values run: | echo "BUILD_DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV echo "BUILD_VERSION=$(git describe --always --tags)" >> $GITHUB_ENV + if [[ "${{github.event_name}}" == "pull_request" ]]; then + echo "::set-output name=github_user::${{github.event.pull_request.head.repo.owner.login}}" + else + echo "::set-output name=github_user::$(echo ${{github.repository}} | cut -d'/' -f1)" + fi - - name: Hello JoininBox + - name: Display the build name run: echo "Building the joininbox-arm64-rpi-image-${{ env.BUILD_DATE }}-${{ env.BUILD_VERSION }}" - name: Set up QEMU @@ -42,8 +48,9 @@ jobs: - name: Run the build script run: | + echo "Running with: ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF" cd ci/arm64-rpi - bash arm64-rpi.sh $GITHUB_ACTOR $GITHUB_HEAD_REF + bash arm64-rpi.sh ${{steps.set_values.outputs.github_user}} $GITHUB_HEAD_REF - name: Compute checksum of the raw image run: | diff --git a/build_joininbox.sh b/build_joininbox.sh index 267e138..3029fb0 100644 --- a/build_joininbox.sh +++ b/build_joininbox.sh @@ -368,7 +368,9 @@ echo "# JoininBox" echo "#############" echo echo "# add the 'joinmarket' user" -adduser --disabled-password --gecos "" joinmarket +adduser --system --group --shell /bin/bash --home /home/joinmarket joinmarket +echo "Copy the skeleton files for login" +sudo -u joinmarket cp -r /etc/skel/. /home/joinmarket/ echo "# clone the joininbox repo and copy the scripts" cd /home/joinmarket || exit 1 @@ -607,7 +609,7 @@ echo "#########################" echo "# Download Bitcoin Core" echo "#########################" echo -sudo -u joinmarket /home/joinmarket/install.bitcoincore.sh downloadCoreOnly || exit 1 +sudo -u joinmarket bash /home/joinmarket/install.bitcoincore.sh downloadCoreOnly || exit 1 echo echo "######################" @@ -623,7 +625,7 @@ if [ "$4" = "without-qt" ]; then qtgui="false" sed -i "s/^qtgui=.*/qtgui=false/g" /home/joinmarket/joinin.conf fi -sudo -u joinmarket /home/joinmarket/install.joinmarket.sh -i install -q $qtgui || exit 1 +sudo -u joinmarket bash /home/joinmarket/install.joinmarket.sh -i install -q $qtgui || exit 1 echo "###################" echo "# bootstrap.service" diff --git a/ci/amd64/debian/joininbox-amd64-debian.json b/ci/amd64/debian/joininbox-amd64-debian.json index 539f784..f4fb581 100644 --- a/ci/amd64/debian/joininbox-amd64-debian.json +++ b/ci/amd64/debian/joininbox-amd64-debian.json @@ -1,23 +1,17 @@ { "variables": { - "iso_name": "debian-12.1.0-amd64-netinst.iso", - "iso_checksum": "9f181ae12b25840a508786b1756c6352a0e58484998669288c4eec2ab16b8559", + "iso_name": "debian-12.2.0-amd64-netinst.iso", + "iso_checksum": "23ab444503069d9ef681e3028016250289a33cc7bab079259b73100daee0af66", "box_basename": "debian", "build_directory": "../builds", - "build_timestamp": "{{isotime \"20060102150405\"}}", "cpus": "2", "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`}}", "memory": "2048", "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", @@ -56,8 +50,6 @@ "boot_wait": "5s", "cpus": "{{ user `cpus` }}", "disk_size": "{{user `disk_size`}}", - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "guest_additions_url": "{{ user `guest_additions_url` }}", "guest_os_type": "Debian_64", "hard_drive_interface": "sata", "headless": "{{ user `headless` }}", diff --git a/ci/amd64/packer.build.amd64-debian.sh b/ci/amd64/packer.build.amd64-debian.sh index 6f6925a..2cded91 100644 --- a/ci/amd64/packer.build.amd64-debian.sh +++ b/ci/amd64/packer.build.amd64-debian.sh @@ -1,14 +1,19 @@ #!/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 packer +if ! packer version 2>/dev/null; then + 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 +else + echo "# Packer is installed" +fi # Install qemu -echo -e "\nInstalling qemu..." +echo "# Install qemu ..." +sudo apt-get update sudo apt-get install -y qemu-system if [ $# -gt 0 ]; then @@ -24,7 +29,7 @@ else fi # Build the image -echo -e "\nBuilding image..." +echo "# Building image ..." cd debian PACKER_LOG=1 packer build \ -var github_user=${github_user} -var branch=${branch} \ diff --git a/scripts/install.joinmarket.sh b/scripts/install.joinmarket.sh index 5de3248..2251308 100755 --- a/scripts/install.joinmarket.sh +++ b/scripts/install.joinmarket.sh @@ -123,7 +123,9 @@ source /home/joinmarket/joinin.conf # create user if not default if [ "${user}" != "joinmarket" ]; then echo "# add the '${user}' user" - sudo adduser --disabled-password --gecos "" ${user} + sudo adduser --system --group --shell /bin/bash --home /home/${user} ${user} + echo "Copy the skeleton files for login" + sudo -u ${user} cp -r /etc/skel/. /home/${user}/ sudo adduser ${user} sudo # add user to Tor group sudo usermod -a -G debian-tor ${user} diff --git a/scripts/jam-remote/install.jam.sh b/scripts/jam-remote/install.jam.sh index 10c67e2..5fe7958 100644 --- a/scripts/jam-remote/install.jam.sh +++ b/scripts/jam-remote/install.jam.sh @@ -3,7 +3,7 @@ # https://github.com/joinmarket-webui/jam USERNAME=jam -WEBUI_VERSION=0.1.5 +WEBUI_VERSION="v0.1.6" REPO=joinmarket-webui/jam HOME_DIR=/home/${USERNAME} APP_DIR=webui @@ -46,7 +46,7 @@ if [ "$1" = "on" ]; then echo "# Creating the ${USERNAME} user" echo - sudo adduser --disabled-password --gecos "" ${USERNAME} + sudo adduser --system --group --home /home/${USERNAME} ${USERNAME} # install nodeJS bash ${SOURCEDIR}/bonus.nodejs.sh on @@ -57,10 +57,10 @@ if [ "$1" = "on" ]; then sudo -u $USERNAME git clone https://github.com/$REPO cd jam || exit 1 - sudo -u $USERNAME git reset --hard v${WEBUI_VERSION} + sudo -u $USERNAME git reset --hard ${WEBUI_VERSION} - sudo -u $USERNAME bash ${SOURCEDIR}/../verify.git.sh \ - "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "v${WEBUI_VERSION}" || exit 1 + #sudo -u $USERNAME bash ${SOURCEDIR}/../verify.git.sh \ + # "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "v${WEBUI_VERSION}" || exit 1 cd $HOME_DIR || exit 1 sudo -u $USERNAME mv jam $APP_DIR @@ -134,10 +134,15 @@ if [ "$1" = "update" ]; then echo "FAIL - npm install did not run correctly, aborting" exit 1 fi - - sudo -u $USERNAME npm run build echo "*** JAM UPDATED to $version ***" fi + + if ! sudo -u $USERNAME npm install; then + echo "FAIL - npm install did not run correctly, aborting" + exit 1 + fi + sudo -u $USERNAME npm run build + else echo "*** JAM NOT INSTALLED ***" fi diff --git a/scripts/standalone/_functions.standalone.sh b/scripts/standalone/_functions.standalone.sh index 42939e5..32f909a 100755 --- a/scripts/standalone/_functions.standalone.sh +++ b/scripts/standalone/_functions.standalone.sh @@ -3,7 +3,7 @@ function addUserStore() { if [ ! -d /home/store/app-data ]; then echo "# Adding the user: store" - sudo adduser --disabled-password --gecos "" store + sudo adduser --system --group --home /home/store store sudo -u store mkdir /home/store/app-data echo "# Add the joinmarket user to the store group" sudo usermod -aG store joinmarket @@ -120,7 +120,9 @@ function downloadSnapShot() { sudo mkdir -p /home/store/app-data/.bitcoin fi echo "# Making sure user: bitcoin exists" - sudo adduser --disabled-password --gecos "" bitcoin + sudo adduser --system --group --shell /bin/bash --home /home/bitcoin bitcoin + echo "Copy the skeleton files for login" + sudo -u bitcoin cp -r /etc/skel/. /home/bitcoin/ sudo chown -R bitcoin:bitcoin /home/store/app-data/.bitcoin echo "# Add the joinmarket user to the bitcoin group" sudo usermod -aG bitcoin joinmarket @@ -154,7 +156,9 @@ function installBitcoinCoreStandalone() { echo "${installedVersion} is already installed" else echo "# Adding the user: bitcoin" - sudo adduser --disabled-password --gecos "" bitcoin + sudo adduser --system --group --shell /bin/bash --home /home/bitcoin bitcoin + echo "Copy the skeleton files for login" + sudo -u bitcoin cp -r /etc/skel/. /home/bitcoin/ echo "# Add the joinmarket user to the bitcoin group" sudo usermod -aG bitcoin joinmarket echo "# Installing Bitcoin Core v${bitcoinVersion}" diff --git a/scripts/standalone/install.specter.sh b/scripts/standalone/install.specter.sh index dfb21eb..954ecc3 100755 --- a/scripts/standalone/install.specter.sh +++ b/scripts/standalone/install.specter.sh @@ -149,7 +149,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then addUserStore - sudo adduser --disabled-password --gecos "" specter + sudo adduser --system --group --home /home/specter specter # store data with the store user sudo mkdir -p /home/store/app-data/.specter 2>/dev/null