Add debian packaging

This commit is contained in:
pancake committed 2026-04-30 18:34:12 +02:00
1 parent 137ca47e97
commit ca4d5e0d26
6 files changed
+192 -1

No files matched your search

+35 -1
View File
@@ -5,6 +5,9 @@ on:
branches: ['**']
pull_request:
env:
R2V: 6.1.4
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@@ -20,6 +23,37 @@ jobs:
- uses: actions/checkout@v4
- uses: radareorg/github-actions@v1
with:
version: '6.1.4'
version: ${{ env.R2V }}
- name: Build
run: make
debian:
name: Build Debian package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install build deps
run: sudo apt-get update -y && sudo apt-get install -y build-essential pkg-config wget
- name: Download Radare2 Debian packages
run: |
wget -O r2.deb https://github.com/radareorg/radare2/releases/download/${{ env.R2V }}/radare2_${{ env.R2V }}_amd64.deb
wget -O r2-dev.deb https://github.com/radareorg/radare2/releases/download/${{ env.R2V }}/radare2-dev_${{ env.R2V }}_amd64.deb
- name: Install Radare2
run: sudo dpkg -i r2.deb r2-dev.deb
- name: Build Debian package
run: make -C dist/debian SUDO=
- name: Upload Debian package artifact
uses: actions/upload-artifact@v4
with:
name: debian-package
path: dist/debian/*.deb
if-no-files-found: error
+8
View File
@@ -5,6 +5,14 @@
*.o
/r2unity
# Debian packaging artifacts
/dist/debian/*.deb
/dist/debian/build/
/dist/debian/control/
/dist/debian/data/
/dist/debian/debian-binary
/dist/debian/root/
# Third-party reference checkouts (radare2, il2cpp dumper, etc.)
/third_party/
+22
View File
@@ -0,0 +1,22 @@
PACKAGE=r2unity
VERSION_RAW=$(shell git -C ../.. describe --tags --always --dirty 2>/dev/null || echo 0.0.0)
VERSION_BASE=$(shell printf '%s' "$(VERSION_RAW)" | sed -e 's/^v//' -e 's/-/+/g')
VERSION=$(shell v='$(VERSION_BASE)'; expr "$$v" : '[0-9]' >/dev/null && printf '%s' "$$v" || printf '0.0.0+git%s' "$$v")
DEPENDS=radare2
SECTION=user/shell
PRIORITY=optional
MAINTAINER=pancake <[email protected]>
UNAMEM=$(shell uname -m)
DPKG_ARCH=$(shell command -v dpkg >/dev/null 2>&1 && dpkg --print-architecture)
ifneq ($(DPKG_ARCH),)
ARCH=$(DPKG_ARCH)
else ifeq ($(UNAMEM),x86_64)
ARCH=amd64
else ifeq ($(UNAMEM),aarch64)
ARCH=arm64
else ifeq ($(UNAMEM),arm64)
ARCH=arm64
else
ARCH=$(UNAMEM)
endif
+2
View File
@@ -0,0 +1,2 @@
Unity IL2CPP metadata tool and radare2 plugin
r2unity inspects Unity IL2CPP binaries and global-metadata.dat files, exposing recovered metadata as CLI output or radare2 flags and comments through its core plugin.
+40
View File
@@ -0,0 +1,40 @@
include ./CONFIG
UNAME=$(shell uname)
SUDO?=sudo
PWD=$(shell pwd)
PACKAGE_DIR?=$(PWD)
R2_VERSION=$(shell r2 -qv 2>/dev/null || echo last)
R2PLUGDIR?=/usr/lib/radare2/$(R2_VERSION)
R2_PLUGINS=core_r2unity.so
all: root
$(SUDO) rm -rf control data
$(MAKE) clean
mkdir -p data
cp -rf root/* data
$(MAKE) control
$(MAKE) deb
root:
ifneq ($(UNAME),Linux)
@echo "Debian packages must be built on Linux so radare2 plugins are built as .so files."
@false
else
cd ../.. && $(MAKE) clean && $(MAKE) && $(MAKE) plugin
rm -rf root
mkdir -p root/usr/bin
cp -f ../../r2unity root/usr/bin/
mkdir -p root/$(R2PLUGDIR)
for plugin in $(R2_PLUGINS); do cp -f ../../src/r2/$$plugin root/$(R2PLUGDIR)/; done
mkdir -p root/usr/share/doc/r2unity
cp -f ../../README.md root/usr/share/doc/r2unity/
endif
purge: clean
rm -rf root
summary:
echo $(VERSION)
include deb.mk
+85
View File
@@ -0,0 +1,85 @@
# Create .deb without using dpkg tools.
#
# Author: Tim Wegener <[email protected]>
#
# Use 'include deb.mk' after defining the user variables in a local
# makefile.
ifeq ($(shell uname),Darwin)
MD5SUM=md5
else
MD5SUM=md5sum
endif
GAWK=awk
PACKAGE_DIR=$(shell pwd)
CONTROL_EXTRAS ?= ${wildcard preinst postinst prerm postrm}
${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CONTROL_EXTRAS} DESCR \
${ICON_SOURCE}
mkdir -p $@
ifneq (${CONTROL_EXTRAS},)
cp ${CONTROL_EXTRAS} $@
endif
echo "Package: ${PACKAGE}" > $@/control
echo "Version: ${VERSION}" >> $@/control
echo "Section: ${SECTION}" >> $@/control
echo "Priority: ${PRIORITY}" >> $@/control
echo "Architecture: ${ARCH}" >> $@/control
ifneq (${DEPENDS},)
echo "Depends: ${DEPENDS}" >> $@/control
endif
echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data|cut -f1}" \
>> $@/control
echo "Maintainer: ${MAINTAINER}" >> $@/control
printf "Description:" >> $@/control
cat DESCR | ${GAWK} '{print " "$$0;}' >> $@/control
cd ${PACKAGE_DIR}/data && find . -type f -exec ${MD5SUM} {} \; \
| sed -e 's| \./||' \
> $@/md5sums
${PACKAGE_DIR}/debian-binary:
echo "2.0" > $@
${PACKAGE_DIR}/clean:
rm -rf ${PACKAGE_DIR}/data ${PACKAGE_DIR}/control ${PACKAGE_DIR}/build *.deb
${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data
rm -rf $@
mkdir $@
cp ${PACKAGE_DIR}/debian-binary $@/
cd ${PACKAGE_DIR}/control && tar czvf $@/control.tar.gz *
cd ${PACKAGE_DIR}/data && \
COPY_EXTENDED_ATTRIBUTES_DISABLE=true \
COPYFILE_DISABLE=true \
tar cpzvf $@/data.tar.gz *
${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build
ar -rc $@ $</debian-binary $</control.tar.gz $</data.tar.gz
.PHONY: data
data: ${PACKAGE_DIR}/data
.PHONY: control
control: ${PACKAGE_DIR}/control
.PHONY: build
build: ${PACKAGE_DIR}/build
.PHONY: clean
clean: ${PACKAGE_DIR}/clean $(EXTRA_CLEAN)
rm -f debian-binary
.PHONY: deb
deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb
clobber::
rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data ${PACKAGE_DIR}/build
push:
scp *.deb radare.org:/srv/http/radareorg/cydia/debs
mrproper: clean
rm -rf root