Skip to content

Commit 380763d

Browse files
authored
Merge pull request #2 from crowdsecurity/add_upgrade_script
add upgrade script
2 parents cdf0cc4 + f7ead6f commit 380763d

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ release: build
5151
@cp -R ./config $(RELDIR)/
5252
@cp ./scripts/install.sh $(RELDIR)/
5353
@cp ./scripts/uninstall.sh $(RELDIR)/
54+
@cp ./scripts/upgrade.sh $(RELDIR)/
5455
@chmod +x $(RELDIR)/install.sh
5556
@chmod +x $(RELDIR)/uninstall.sh
57+
@chmod +x $(RELDIR)/upgrade.sh
5658
@tar cvzf cs-custom-bouncer.tgz $(RELDIR)
5759

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ If your bouncer run on the same machine as your crowdsec local API, you can star
4848
sudo systemctl start cs-custom-bouncer
4949
```
5050

51+
## Upgrade
52+
53+
## Upgrade
54+
55+
If you already have `cs-custom-bouncer` installed, please download the [latest release](https://github.com/crowdsecurity/cs-custom-bouncer/releases) and run the following commands to upgrade it:
56+
57+
```bash
58+
tar xzvf cs-custom-bouncer.tgz
59+
cd cs-custom-bouncer-v*/
60+
sudo ./upgrade.sh
61+
```
62+
5163
## Usage
5264

5365
The custom binary will be called with the following arguments :

scripts/upgrade.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
BIN_PATH_INSTALLED="/usr/local/bin/cs-custom-bouncer"
3+
BIN_PATH="./cs-custom-bouncer"
4+
5+
6+
upgrade_bin() {
7+
rm "${BIN_PATH_INSTALLED}" || (echo "cs-custom-bouncer is not installed, exiting." && exit 1)
8+
install -v -m 755 -D "${BIN_PATH}" "${BIN_PATH_INSTALLED}"
9+
}
10+
11+
12+
if ! [ $(id -u) = 0 ]; then
13+
log_err "Please run the upgrade script as root or with sudo"
14+
exit 1
15+
fi
16+
17+
systemctl stop cs-custom-bouncer
18+
upgrade_bin
19+
systemctl start cs-custom-bouncer
20+
echo "cs-custom-bouncer upgraded successfully."

0 commit comments

Comments
 (0)