Skip to content

Commit

Permalink
build: update to Debian 12.2.0, create home folders as 0755 (#139)
Browse files Browse the repository at this point in the history
* build: create home folders as 0755 on Debian 12
* build: add bash
* fix: add  --shell /bin/bash  to user creation
* copy the skeleton files for users with login
* update workflows
* jam-remote update to v0.1.6
* amd64 image update to debian-12.2.0, clean vars
  • Loading branch information
openoms authored Oct 23, 2023
1 parent a596e25 commit c240ba2
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 37 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/amd64-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/arm64-rpi-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
8 changes: 5 additions & 3 deletions build_joininbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "######################"
Expand All @@ -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"
Expand Down
12 changes: 2 additions & 10 deletions ci/amd64/debian/joininbox-amd64-debian.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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` }}",
Expand Down
21 changes: 13 additions & 8 deletions ci/amd64/packer.build.amd64-debian.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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} \
Expand Down
4 changes: 3 additions & 1 deletion scripts/install.joinmarket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
19 changes: 12 additions & 7 deletions scripts/jam-remote/install.jam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions scripts/standalone/_functions.standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/standalone/install.specter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c240ba2

Please sign in to comment.