Skip to content

Commit

Permalink
chore: dump before formatting computer
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Aug 30, 2024
1 parent 9903ebd commit 9a261d9
Show file tree
Hide file tree
Showing 20 changed files with 162 additions and 26 deletions.
29 changes: 22 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Copyright (c) 2024 Tulip <[email protected]>

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@ A [Nushell](https://nushell.sh) wrapper over systemd-nspawn and machinectl initi
```bash
nuspawn remote list # Table of all the available distros on nspawnhub

nuspawn pull --name $NAME $IMAGE $TAG # Pull your machine from
nuspawn pull $NAME $IMAGE $TAG # Pull your machine from NspawnHub or other hosts
nuspawn oci pull $NAME:$TAG # You can also pull OCI images from DockerHub or anywhere else to get a machine
# Recommented OCI images are the [Toolbx Community Images](https://github.com/toolbx-images/images) and [Universal Blue's distrobox images](https://github.com/ublue-os/toolboxes)

nuspawn setup $NAME # (optional) Sets up networking, users and other things in the machine manually if necessary (you should have networking by default)
nuspawn enter $NAME # Run the machine in your current CLI

nuspawn enter $NAME
# If something does not work at first, you can use the setup handler to set up everything manually in the container
nuspawn setup all $NAME
```

### Status of the machines

You can check machine data through these troubleshooting commands
```bash
nuspawn status # Which machines are actually running at any point
nuspawn log # Fancy table of the systemd journal in the machine
nuspawn top # top-like TUI with machine processes
nuspawn ps # Lists all processes in the machine + control groups (requires systemd in the machine + --boot flag)
nuspawn ps # Lists all machines currently running and their statuses
nuspawn logs # Fancy table of the systemd journal in the machine
nuspawn top-tui # top-like TUI with machine processes
nuspawn top # Lists all processes in the machine + control groups (requires systemd in the machine + --boot flag)
```

### Configuring machines
Expand Down
Empty file added apk.Containerfile
Empty file.
36 changes: 36 additions & 0 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Maintainer: Tulip Blossom <[email protected]>

pkgname=nuspawn
pkgver=0.9.0
pkgrel=1
pkgdesc='Distrobox-like wrapper for Systemd-Nspawn and Machinectl written in Nushell'
arch=('x86_64' 'i686' 'armv6h' 'armv7h')
url='https://codeberg.org/tulilirockz/${pkgname}'
license=('BSD-3-Clause')
depends=('nushell', 'systemd')
makedepends=('git', 'scdoc')
provides=("$pkgname=$pkgver")
source=("$url.git")
sha256sums=('SKIP')

pkgver() {
printf $pkgver
}

build() {
cd "${pkgname}"
mkdir -p %{buildroot}%{_libexecdir}/%{pname} %{buildroot}/%{_bindir}
mkdir -p "$pkgdir/usr/share/$pkgname"

sed -i 's/\%GIT_COMMIT\%//g' src/lib/meta.nu
sed -i 's/\%VERSION\%/${pkgver}/g' src/lib/meta.nu
sed -i 's~\.\/lib~\/usr\/libexec/%{pname}~' src/${pkgname}
}

package() {
cd "${pkgname}"
install -D -m 0755 src/%{pname} %{buildroot}%{_bindir}/%{pname}
cp -r src/lib/* %{buildroot}%{_libexecdir}/%{pname}
install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nuspawn (1.0-1) noble; urgency=medium

* Initial release.

-- Tulip Blossom <[email protected]> Mon, 26 Aug 2024 12:57:24 +0300
22 changes: 22 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Source: nuspawn
Section: utils
Prority: optional
Maintainer: Tulip Blossom <[email protected]>
Rules-Requires-Root: no
Build-Depends:
scdoc
Standards-Version: 1.0.0
Homepage: https://codeberg.org/tulilrockz/nuspawn
Vcs-Browser: https://codeberg.org/tulilrockz/nuspawn
Vcs-Git: https://codeberg.org/tulilrockz/nuspawn

Package: nuspawn
Section: utils
Architecture: all
Depends:
${shlibs:Depends},
${misc:Depends},
systemd
nushell
Description: Distrobox-like wrapper for Systemd-Nspawn and Machinectl written in Nushell

24 changes: 24 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2024 Tulip <[email protected]>

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
3 changes: 3 additions & 0 deletions debian/nuspawn.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
usr/bin/nuspawn
usr/share/nuspawn/*
usr/share/man/*
Empty file added debian/rules
Empty file.
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)
1 change: 1 addition & 0 deletions debian/source/options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extend-diff-ignore = "Makefile"
6 changes: 6 additions & 0 deletions debian/upstream/metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bug-Database: https://codeberg.org/tulilirockz/nuspawn/issues
Bug-Submit: https://codeberg.org/tulilirockz/nuspawn/issues/new
Changelog: https://codeberg.org/tulilirockz/nuspawn/blob/master/CHANGES
Documentation: https://codeberg.org/tulilirockz/nuspawn/wiki
Repository-Browse: https://codeberg.org/tulilirockz/nuspawn
Repository: https://codeberg.org/tulilirockz/nuspawn.git
Empty file added ebuild.Containerfile
Empty file.
Empty file added melange.yaml
Empty file.
11 changes: 7 additions & 4 deletions nuspawn.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
Name: nuspawn
Vendor: tulilirockz
Version: 0.7.5+{{{ git_ref }}}
Version: 0.9.0+{{{ git_ref }}}
Release: 0%{?dist}
Summary: Helper for Nspawn and Machinectl
License: 3.0-BSD
License: BSD-3-Clause
URL: https://github.com/%{vendor}/%{name}
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}

BuildArch: noarch
Supplements: systemd
BuildRequires: scdoc
Requires: nu

%description
Expand All @@ -27,13 +28,15 @@ Wraps systemd-nspawn for fetching and easier usage
mkdir -p %{buildroot}%{_libexecdir}/%{pname} %{buildroot}/%{_bindir}
sed -i 's/\%GIT_COMMIT\%/{{ git_ref }}/g' src/lib/meta.nu
sed -i 's/\%VERSION\%/%{VERSION}/g' src/lib/meta.nu
sed -i 's~\.\/lib~\/usr\/libexec/%{pname}~' src/%{pname}
sed -i 's~\.\/lib~\/usr\/share/%{pname}~' src/%{pname}
install -D -m 0755 src/%{pname} %{buildroot}%{_bindir}/%{pname}
cp -r src/lib/* %{buildroot}%{_libexecdir}/%{pname}
cp -r docs/man/* %{buildroot}/share/man
cp LICENSE %{buildroot}/share/licenses/%{pname}

%files
%license LICENSE
%{_libexecdir}/%{name}/*
/usr/share/%{name}/*
%attr(0755,root,root) %{_bindir}/%{pname}

%changelog
Expand Down
Empty file added pkgbuild.Containerfile
Empty file.
2 changes: 1 addition & 1 deletion src/lib/oci.nu
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export def "main oci pull" [
--extract (-e) = true # Extract the image after fetching it
--force (-f) # Force override if image already exists
--machinectl (-m) = true # Use machinectl for operations
image: string # OCI image that will be fetched/stored
name: string # Machine name that will be output from the image
image: string # OCI image that will be fetched/stored
] {
try {
run-external $runtime info | ignore
Expand Down
2 changes: 2 additions & 0 deletions src/lib/pull.nu
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export def --env "main pull" [
return
}

assert (($image != null) and ($tag != null)) "Both the machine's image and tag are necessary"

let fetched_url = (
if $from_url != null { $from_url }
else { $"($nspawnhub_url)/($image)/($tag)/($type)/image.($type).xz"})
Expand Down
29 changes: 22 additions & 7 deletions src/lib/version.nu
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,28 @@ dP dP 88888P Y88888P 88Y888P 88888P8 8888P Y8P dP dP 8P
}
# Display nuspawn license
export def "main version license" [] {
"Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
'Copyright (c) 2024 Tulip <[email protected]>
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors may
be used to endorse or promote products derived from this software
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.'
}
1 change: 1 addition & 0 deletions src/stub-resolv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nameserver 1.1.1.1

0 comments on commit 9a261d9

Please sign in to comment.