Skip to content

Commit

Permalink
Build libnode as unprivileged user
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Feb 27, 2024
1 parent 7481d82 commit 0e2060d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ jobs:
with:
fetch-depth: 0

- name: install libnode
run: build/archlinux/node/install-libnode
- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
tee -a /etc/sudoers.d/$UNPRIVILEGED <<< "$UNPRIVILEGED ALL = NOPASSWD: $(which pacman)"
- name: Build libnode
run: sudo -u $UNPRIVILEGED build/archlinux/node/build-libnode

- name: Archive nodejs' PKGBUILD.shared
uses: actions/upload-artifact@v3
Expand All @@ -92,11 +98,8 @@ jobs:
retention-days: 7
path: "build/archlinux/node/PKGBUILD.shared"

- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
tee -a /etc/sudoers.d/$UNPRIVILEGED <<< "$UNPRIVILEGED ALL = NOPASSWD: $(which pacman)"
- name: Install libnode
run: pacman -S -p build/archlinux/node/nodejs-shared-*.pkg.tar.zst

- name: Create PKGBUILD
run: sudo -u $UNPRIVILEGED build/archlinux/mk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sed -i "s,./configure,./configure --shared," PKGBUILD.shared
SHA256=$(sha256sum PKGBUILD.shared | cut -f1 -d' ')
echo "PKGBUILD.shared SHA256: $SHA256"

makepkg -si --noconfirm
makepkg

pkgname=$(. PKGBUILD.shared; echo "$pkgname")
pkgver=$(. PKGBUILD.shared; echo "$pkgver")
Expand Down

0 comments on commit 0e2060d

Please sign in to comment.