Skip to content

Commit

Permalink
fix install script
Browse files Browse the repository at this point in the history
  • Loading branch information
n-hass committed May 21, 2023
1 parent d65fc7f commit f25cb3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
3 changes: 0 additions & 3 deletions build.sh

This file was deleted.

16 changes: 9 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit f25cb3e

Please sign in to comment.