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/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/build.sh b/install.sh similarity index 66% rename from build.sh rename to install.sh index b9e3c57..8cbb06c 100755 --- a/build.sh +++ b/install.sh @@ -5,12 +5,6 @@ if [[ $(/usr/bin/id -u) -ne 0 ]]; then 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 @@ -18,4 +12,5 @@ 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 +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