Skip to content

Instantly share code, notes, and snippets.

@andrewmackrodt
Last active March 19, 2024 21:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewmackrodt/18cb41743487f5fdaa4a9e737f65424a to your computer and use it in GitHub Desktop.
Save andrewmackrodt/18cb41743487f5fdaa4a9e737f65424a to your computer and use it in GitHub Desktop.
Ubuntu 22.04 deb creator for asusctl
#!/bin/bash
set -euo pipefail
cd $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
build_dir=$(mktemp -d)
cleanup() {
if [[ -d "$build_dir" ]]; then
rm -rf "$build_dir"
fi
}
trap cleanup exit
cd "$build_dir"
cat <<'EOF' >Dockerfile
FROM ubuntu:22.04
RUN DEBIAN_FRONTEND=noninteractive apt update -qqy \
&& apt install -qqy cmake curl g++ git pkg-config ruby \
&& gem install fpm \
&& rm -rf /var/lib/apt/lists/*
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN DEBIAN_FRONTEND=noninteractive apt update -qqy \
&& apt install -qqy \
libatk1.0-dev libclang-dev libfontconfig-dev libgdk-pixbuf-2.0-dev \
libgtk-3-dev libpango1.0-dev libudev-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 --branch 4.5.8 https://gitlab.com/asus-linux/asusctl.git
WORKDIR /asusctl
RUN . "$HOME/.cargo/env" \
&& make
RUN make DESTDIR=/target install \
&& fpm -s dir -t deb -C /target \
--name asusctl \
--license MPL-2.0 \
--version 4.5.8 \
--iteration 1 \
--description "asusd is a utility for Linux to control many aspects of various ASUS laptops but can also be used with non-asus laptops with reduced features." \
--url "https://gitlab.com/asus-linux/asusctl" \
--deb-systemd /target/usr/lib/systemd/system/asusd.service \
--deb-systemd-enable \
--deb-systemd-auto-start \
--depends libc6 \
--depends libfontconfig1 \
--depends libfreetype6 \
--depends libgcc-s1 \
--depends libglib2.0-0 \
--depends libgtk-3-0 \
--depends libudev1 \
. \
&& rm -rf /target \
&& mkdir /target \
&& mv *.deb /target
EOF
docker build -t asusctl-builder .
cid=$(docker create asusctl-builder)
docker cp "$cid:/target/" .
docker rm $cid
cp target/asusctl_*.deb ~/Desktop/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment