diff --git a/Cargo.toml b/Cargo.toml index f4b5eb7..8efc587 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,6 @@ name = "autosleep" version = "0.2.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] clap = { version = "4.2.7", features = ["derive"] } configparser = "3.0.2" diff --git a/README.md b/README.md index 9809c0f..4eb166f 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ Your defined activity checks will all be run together every set number of second # Installation 1. Clone the repo -2. Build with `./build.sh` -3. Install with `sudo ./install.sh` +2. Install with `./install.sh` This will: build the binary application and move it to `/usr/local/bin`, install the systemd service and the configuration files with a couple demonstrative checks in the directory `/etc/autosleep.d/checks`. diff --git a/build.sh b/build.sh deleted file mode 100755 index 26156ef..0000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -cargo build --release diff --git a/install.sh b/install.sh index 953a11a..1a587ef 100755 --- a/install.sh +++ b/install.sh @@ -4,10 +4,12 @@ APP_PATH="" if ls autosleep &> /dev/null; then chmod +x autosleep APP_PATH="autosleep" -fi -if ls target/release/autosleep &> /dev/null; then +elif ls target/release/autosleep &> /dev/null; then + APP_PATH="target/release/autosleep" +else cargo build --release && APP_PATH="target/release/autosleep" fi + if [ -z "$APP_PATH" ]; then echo "no autosleep binary found" exit 1 @@ -18,16 +20,16 @@ for i in $(ls base/checks); do done # move the binary -mv -f $APP_PATH /usr/local/bin/autosleep +sudo mv -f $APP_PATH /usr/local/bin/autosleep # make the directories needed -mkdir -p /etc/autosleep.d +sudo mkdir -p /etc/autosleep.d # copy the service file -cp base/autosleep.service /usr/lib/systemd/system/autosleep.service +sudo cp base/autosleep.service /usr/lib/systemd/system/autosleep.service # copy the config file -cp base/autosleep.conf /etc/autosleep.d/autosleep.conf +sudo cp base/autosleep.conf /etc/autosleep.d/autosleep.conf # copy the checks dir -cp -r base/checks /etc/autosleep.d/checks +sudo cp -r base/checks /etc/autosleep.d/checks