diff --git a/README.md b/README.md index 3f33312..245501e 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -# lunatik_packages \ No newline at end of file +# Lunatik Packaging + +This repository contains the Debian packaging files for **Lunatik** — the kernel Lua scripting framework. + +## Contents + +- `debian/` directory with all packaging metadata and scripts +- DKMS configuration files for building kernel modules dynamically +- Post-install and helper scripts used during package installation +- Debian changelog, rules, control files, and other packaging assets + +## Submodule Integration with Lunatik +This repository is intended to be used as a Git submodule within the main Lunatik repository. + +To clone the main Lunatik repository along with this packaging submodule: + +``` +git clone --recurse-submodules https://github.com/luainkernel/lunatik.git +``` + +If you've already cloned Lunatik without submodules: + +``` +git submodule update --init --recursive +``` + +## Building the Debian Package + +Because Debian packaging tools expect the debian/ directory to be at the root, you must first symlink the packaging directory: + +``` +ln -s lunatik_packages/debian ./debian +``` + +Then run the build command: + +```bash +dpkg-buildpackage -us -uc +``` \ No newline at end of file diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b7d7a00 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +lunatik (3.6.2-1) unstable; urgency=medium + + * Lunatik, a framework for scripting the Linux kernel with Lua. + + -- Shivam Vashisth Tue, 01 Jul 2025 19:55:00 +0530 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2f530d2 --- /dev/null +++ b/debian/control @@ -0,0 +1,26 @@ +Source: lunatik +Section: kernel +Priority: optional +Maintainer: Shivam Vashisth +Build-Depends: debhelper-compat (= 13), dkms +Standards-Version: 4.6.2 +Homepage: https://github.com/luainkernel/lunatik + +Package: lunatik +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, lua5.4 +Description: User-space tools for the Lunatik kernel module + This package provides the lunatik CLI tool for interacting with the Lunatik + kernel module, including running Lua scripts in the kernel and accessing the + REPL. Intended for kernel developers interested in rapid + prototyping and scripting within the kernel space. + +Package: lunatik-dkms +Architecture: all +Depends: dkms, ${misc:Depends} +Provides: lunatik-modules +Description: DKMS source for the Lunatik kernel modules + This package provides the source code for the Lunatik kernel modules, + allowing DKMS to automatically build and install them for each kernel. + It does not ship prebuilt modules, but builds them locally for each + installed kernel, ensuring compatibility and easy updates. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..60d8386 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,34 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Lunatik +Source: https://github.com/luainkernel/lunatik + +Files: * +Copyright: 2023-2025 Ring Zero Desenvolvimento de Software LTDA +License: MIT or GPL-2.0-only + +Files: debian/* +Copyright: 2025 Shivam Vashisth +License: MIT + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +License: GPL-2.0-only + On Debian systems, the complete text of the GNU General Public License + version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/dkms_post_install.sh b/debian/dkms_post_install.sh new file mode 100644 index 0000000..a5d5ea8 --- /dev/null +++ b/debian/dkms_post_install.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +cd /usr/src/lunatik-#MODULE_VERSION#/ +make scripts_install +make ebpf +make ebpf_install +make btf_install diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..7234abd --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +lunatik_3.6.2-1_source.buildinfo kernel optional diff --git a/debian/lunatik-dkms.dkms b/debian/lunatik-dkms.dkms new file mode 100644 index 0000000..673745e --- /dev/null +++ b/debian/lunatik-dkms.dkms @@ -0,0 +1,67 @@ +PACKAGE_NAME="lunatik" +PACKAGE_VERSION="#MODULE_VERSION#" + +# Main modules built in root directory +BUILT_MODULE_NAME[0]="lunatik" +BUILT_MODULE_NAME[1]="lunatik_run" + +# Library modules built in lib/ subdirectory +BUILT_MODULE_NAME[2]="luadevice" +BUILT_MODULE_NAME[3]="lualinux" +BUILT_MODULE_NAME[4]="luanotifier" +BUILT_MODULE_NAME[5]="luasocket" +BUILT_MODULE_NAME[6]="luarcu" +BUILT_MODULE_NAME[7]="luathread" +BUILT_MODULE_NAME[8]="luafib" +BUILT_MODULE_NAME[9]="luadata" +BUILT_MODULE_NAME[10]="luaprobe" +BUILT_MODULE_NAME[11]="luasyscall" +BUILT_MODULE_NAME[12]="luaxdp" +BUILT_MODULE_NAME[13]="luafifo" +BUILT_MODULE_NAME[14]="luaxtable" +BUILT_MODULE_NAME[15]="luanetfilter" +BUILT_MODULE_NAME[16]="luacompletion" + +BUILT_MODULE_LOCATION[0]="." +BUILT_MODULE_LOCATION[1]="." +BUILT_MODULE_LOCATION[2]="lib" +BUILT_MODULE_LOCATION[3]="lib" +BUILT_MODULE_LOCATION[4]="lib" +BUILT_MODULE_LOCATION[5]="lib" +BUILT_MODULE_LOCATION[6]="lib" +BUILT_MODULE_LOCATION[7]="lib" +BUILT_MODULE_LOCATION[8]="lib" +BUILT_MODULE_LOCATION[9]="lib" +BUILT_MODULE_LOCATION[10]="lib" +BUILT_MODULE_LOCATION[11]="lib" +BUILT_MODULE_LOCATION[12]="lib" +BUILT_MODULE_LOCATION[13]="lib" +BUILT_MODULE_LOCATION[14]="lib" +BUILT_MODULE_LOCATION[15]="lib" +BUILT_MODULE_LOCATION[16]="lib" + +# All modules go to DKMS updates directory +DEST_MODULE_LOCATION[0]="/updates/dkms" +DEST_MODULE_LOCATION[1]="/updates/dkms" +DEST_MODULE_LOCATION[2]="/updates/dkms" +DEST_MODULE_LOCATION[3]="/updates/dkms" +DEST_MODULE_LOCATION[4]="/updates/dkms" +DEST_MODULE_LOCATION[5]="/updates/dkms" +DEST_MODULE_LOCATION[6]="/updates/dkms" +DEST_MODULE_LOCATION[7]="/updates/dkms" +DEST_MODULE_LOCATION[8]="/updates/dkms" +DEST_MODULE_LOCATION[9]="/updates/dkms" +DEST_MODULE_LOCATION[10]="/updates/dkms" +DEST_MODULE_LOCATION[11]="/updates/dkms" +DEST_MODULE_LOCATION[12]="/updates/dkms" +DEST_MODULE_LOCATION[13]="/updates/dkms" +DEST_MODULE_LOCATION[14]="/updates/dkms" +DEST_MODULE_LOCATION[15]="/updates/dkms" +DEST_MODULE_LOCATION[16]="/updates/dkms" + +AUTOINSTALL="yes" +# BTF-enabled build with proper configuration flags +MAKE[0]="make KERNELDIR=/lib/modules/\${kernelver}/build CONFIG_DEBUG_INFO_BTF=y" +CLEAN="make clean" + +POST_INSTALL="dkms_post_install.sh" diff --git a/debian/lunatik.1 b/debian/lunatik.1 new file mode 100644 index 0000000..83a3aed --- /dev/null +++ b/debian/lunatik.1 @@ -0,0 +1,12 @@ +.TH LUNATIK 1 "June 2025" "Lunatik 3.6.2" "User Commands" +.SH NAME +lunatik \- Lua scripting framework for the Linux kernel +.SH SYNOPSIS +.B lunatik +.RI [ script.lua ] +.SH DESCRIPTION +Lunatik provides a way to run Lua scripts inside the Linux kernel, enabling rapid prototyping and extension of kernel functionality. This tool allows you to load and manage kernel Lua scripts. +.SH AUTHOR +Shivam Vashisth +.SH HOMEPAGE +https://github.com/luainkernel/lunatik diff --git a/debian/lunatik.install b/debian/lunatik.install new file mode 100644 index 0000000..0114a14 --- /dev/null +++ b/debian/lunatik.install @@ -0,0 +1 @@ +bin/lunatik usr/bin/ diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..0fb8bd0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,31 @@ +#!/usr/bin/make -f + +export DEB_VERSION_UPSTREAM := $(shell dpkg-parsechangelog -SVersion | sed 's/-.*//') + +%: + dh $@ --with dkms + +override_dh_auto_build: + + make bin/lunatik + +override_dh_auto_install: + + make clean + mkdir -p debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ + rsync -a --exclude=debian --exclude=.git --exclude=.gitignore --exclude=.gitmodules ./ debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ + cp debian/lunatik-dkms.dkms debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/dkms.conf + cp debian/dkms_post_install.sh debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ + chmod +x debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/dkms_post_install.sh + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.ko' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.o' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.mod.*' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.cmd' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.symvers' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -name '*.order' -delete + find debian/lunatik-dkms/usr/src/lunatik-$(DEB_VERSION_UPSTREAM)/ -type f ! -name '*.sh' ! -name '*.lua' ! -name '*.pl' ! -name '*.py' -exec chmod -x {} + + make examples_install + make tests_install + +override_dh_dkms: + dh_dkms -V"$(DEB_VERSION_UPSTREAM)" diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..8c7a14c --- /dev/null +++ b/debian/watch @@ -0,0 +1,4 @@ +version=4 +opts=filenamemangle=s/.+\/v?(\d[\d\.]*)\.tar\.gz/lunatik-$1.tar.gz/ \ + https://github.com/luainkernel/lunatik/releases \ + .*/archive/refs/tags/v?(\d[\d\.]*)\.tar\.gz