Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
# lunatik_packages
# 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
Copy link
Copy Markdown
Collaborator

@marcelstanley marcelstanley Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole section should be updated as soon as you add lunatik as a submodule, as requested at #3 (comment)

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a matter of completeness, you should also refer to the lunatik setup here.

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
Comment thread
marcelstanley marked this conversation as resolved.
```
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
lunatik (3.6.2-1) unstable; urgency=medium

* Lunatik, a framework for scripting the Linux kernel with Lua.

-- Shivam Vashisth <vashisth11shivam@gmail.com> Tue, 01 Jul 2025 19:55:00 +0530
26 changes: 26 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Source: lunatik
Section: kernel
Priority: optional
Maintainer: Shivam Vashisth <vashisth11shivam@gmail.com>
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.
34 changes: 34 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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 <vashisth11shivam@gmail.com>
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".
7 changes: 7 additions & 0 deletions debian/dkms_post_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
cd /usr/src/lunatik-#MODULE_VERSION#/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems #MODULE_VERSION# is not being properly resolved. The post install script for lunatik-dkms_3.6.2-1_all.deb fails with:

Running the post_install script:
/var/lib/dkms/lunatik/3.6.2/source/dkms_post_install.sh: 3: cd: can't cd to /usr/src/lunatik-#MODULE_VERSION#/
depmod......

I had to do the following to properly wrap up the installation:

cd /usr/src/lunatik-3.6.2/
sudo su
make scripts_install
make ebpf
make ebpf_install
make btf_install

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tell me your env and kernel version ?

Copy link
Copy Markdown
Collaborator

@marcelstanley marcelstanley Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my env:

vboxuser@test-vm:~$ uname -a
Linux test-vm 6.14.0-23-generic #23-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 13 23:02:20 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vboxuser@test-vm:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 25.04
Release:        25.04
Codename:       plucky
vboxuser@test-vm:~/development/luainkernel/lunatik-3.6.2$ git status
HEAD detached at v3.6.2
vboxuser@test-vm:~/development/shivam/lunatik_packages$ git status
On branch fix_dkms_package
Your branch is up to date with 'origin/fix_dkms_package'.
```

make scripts_install
make ebpf
make ebpf_install
make btf_install
1 change: 1 addition & 0 deletions debian/files
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lunatik_3.6.2-1_source.buildinfo kernel optional
67 changes: 67 additions & 0 deletions debian/lunatik-dkms.dkms
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 12 additions & 0 deletions debian/lunatik.1
Original file line number Diff line number Diff line change
@@ -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 <Vashisth11shivam@gmail.com>
.SH HOMEPAGE
https://github.com/luainkernel/lunatik
1 change: 1 addition & 0 deletions debian/lunatik.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/lunatik usr/bin/
31 changes: 31 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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)"
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
4 changes: 4 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -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