Skip to content

Instantly share code, notes, and snippets.

@bketelsen
Created May 26, 2023 00:08
Show Gist options
  • Save bketelsen/80b38a0058d2d860bd83222a6508e649 to your computer and use it in GitHub Desktop.
Save bketelsen/80b38a0058d2d860bd83222a6508e649 to your computer and use it in GitHub Desktop.
building apx for silverblue
FROM golang
WORKDIR /tmp
RUN git clone --recursive https://github.com/vanilla-os/apx && cd apx
COPY Makefile /tmp/apx/Makefile
RUN cd apx && make build && make install
PREFIX=/usr/
DESTDIR=/
BINARY_NAME=apx
all: build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ${BINARY_NAME}
install:
install -Dm755 ${BINARY_NAME} ${DESTDIR}${PREFIX}/bin/${BINARY_NAME}
mkdir -p ${DESTDIR}etc/apx
sed -i 's|/usr/share/apx/distrobox|${PREFIX}/share/apx/distrobox|g' config/config.json
install -Dm644 config/config.json ${DESTDIR}etc/apx/config.json
mkdir -p ${DESTDIR}${PREFIX}/share/apx
sh distrobox/install --prefix ${DESTDIR}${PREFIX}/share/apx
mv ${DESTDIR}${PREFIX}/share/apx/bin/distrobox* ${DESTDIR}${PREFIX}/share/apx/.
install-manpages:
mkdir -p ${DESTDIR}${PREFIX}/share/man/man1
cp -r man/* ${DESTDIR}${PREFIX}/share/man/.
chmod 644 ${DESTDIR}${PREFIX}/share/man/man1/*
clean:
rm -f ${BINARY_NAME}
go clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment