From c0f8085da8b79fc448bb6c1d7f1875228c42d5b0 Mon Sep 17 00:00:00 2001 From: tylermurphy534 Date: Tue, 8 Nov 2022 22:07:02 -0500 Subject: aur support --- Cargo.lock | 2 +- Cargo.toml | 2 +- build.sh | 21 --------------------- deployments/aur/.SRCINFO | 11 +++++++++++ deployments/aur/PKGBUILD | 42 ++++++++++++++++++++++++++++++++++++++++++ install.sh | 16 ++++++++++++++++ readme.md | 9 +++++++-- 7 files changed, 78 insertions(+), 25 deletions(-) delete mode 100755 build.sh create mode 100644 deployments/aur/.SRCINFO create mode 100644 deployments/aur/PKGBUILD create mode 100755 install.sh diff --git a/Cargo.lock b/Cargo.lock index e401bd5..a1b0e2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crab" -version = "4.2.0" +version = "0.0.1" dependencies = [ "exec", "nix", diff --git a/Cargo.toml b/Cargo.toml index d063d87..9db50ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "crab" -version = "4.2.0" +version = "0.0.1" edition = "2021" [dependencies] diff --git a/build.sh b/build.sh deleted file mode 100755 index b9e3c57..0000000 --- a/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -if [[ $(/usr/bin/id -u) -ne 0 ]]; then - echo "Please run this as root" - exit -fi - -# Make sure rust is able to build as root -rustup default stable - -# Build crab -cargo build --release - -# Copy executable to bin -cp ./target/release/crab /bin/crab -chown root:root /bin/crab -chmod 6755 /bin/crab - -# Set up config files -cp pam /etc/pam.d/crab -cp -n conf /etc/crab.conf \ No newline at end of file diff --git a/deployments/aur/.SRCINFO b/deployments/aur/.SRCINFO new file mode 100644 index 0000000..6f109a1 --- /dev/null +++ b/deployments/aur/.SRCINFO @@ -0,0 +1,11 @@ +pkgbase = crab + pkgdesc = A rusty permission authentication system + pkgver = 0.0.1 + pkgrel = 1 + url = https://g.tylerm.dev/tylermurphy534/crab.git + arch = x86_64 + license = GPL + source = git+https://g.tylerm.dev/tylermurphy534/crab.git + md5sums = SKIP + +pkgname = crab diff --git a/deployments/aur/PKGBUILD b/deployments/aur/PKGBUILD new file mode 100644 index 0000000..924509d --- /dev/null +++ b/deployments/aur/PKGBUILD @@ -0,0 +1,42 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Tyler Murphy +pkgname=crab +pkgver=0.0.1 +pkgrel=1 +epoch= +pkgdesc="A rusty permission authentication system" +arch=(x86_64) +url="https://g.tylerm.dev/tylermurphy534/crab.git" +license=('GPL') +groups=() +depends=() +makedepends=() +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install= +changelog= +source=("git+$url") +noextract=() +md5sums=('SKIP') +validpgpkeys=() + +build() { + cd crab + cargo build --release +} + +package() { + cd crab + install -D --mode=6755 --owner=root --group=root ./target/release/crab ${pkgdir}/usr/bin/crab + install -D --mode=660 --owner=root --group=root pam ${pkgdir}/etc/pam.d/crab + install -D --mode=664 --owner=root --group=root conf ${pkgdir}/usr/share/crab/crab.conf +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..8cbb06c --- /dev/null +++ b/install.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [[ $(/usr/bin/id -u) -ne 0 ]]; then + echo "Please run this as root" + exit +fi + +# Copy executable to bin +cp ./target/release/crab /bin/crab +chown root:root /bin/crab +chmod 6755 /bin/crab + +# Set up config files +cp pam /etc/pam.d/crab +cp -n conf /etc/crab.conf +chmod 660 /etc/crab.conf diff --git a/readme.md b/readme.md index b659123..470f1e5 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,12 @@ `Crab`, a.k.a `Cool Rust Authentication Binary` is a rusty replacement for sudo and doas on Linux systems # Installation -Run `build.sh` as the root user to build the rust binary, and install files. +### From Source +First run `cargo install --release` to compile the binary. +Then run `install.sh` as the root user to install files. + +### Arch Based Systems +If you are on arch-linux, the pakage is avaliable on the AUR as `crab-git`. # Configuration Crab supports multiple users and persistence. Each line of the config is the username, then `true` of `false` if the crab authentication persists, seperated by a space. @@ -12,4 +17,4 @@ For Example root true tylerm false ``` -The configuration file is stored in `/etc/crab.conf` \ No newline at end of file +The default configuration file is stored in `/usr/share/crab/crab.conf` and must be coppied to `/etc/crab.conf`. \ No newline at end of file -- cgit v1.2.3-freya