Add deb stuff. Correct dependency on database name

This commit is contained in:
jude 2023-05-07 20:59:07 +01:00
parent d496c81003
commit 1c4c4a8b31
7 changed files with 33 additions and 9 deletions

View File

@ -6,7 +6,8 @@ PATREON_ROLE_ID=
LOCAL_TIMEZONE=
MIN_INTERVAL=
PYTHON_LOCATION=
PYTHON_LOCATION=/usr/bin/python3
DONTRUN=web
SECRET_KEY=
REMIND_INTERVAL=

2
debian/.gitignore vendored
View File

@ -1,2 +0,0 @@
*
!.gitignore

13
debian/postinst vendored Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -e
id -u reminder &>/dev/null || useradd -r -M reminder
if [ ! -f /etc/reminder-rs/config.env ]; then
cp /etc/reminder-rs/default.env /etc/reminder-rs/config.env
fi
chown reminder /etc/reminder-rs/config.env
#DEBHELPER#

11
debian/postrm vendored Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
id -u reminder &>/dev/null || userdel reminder
if [ -f /etc/reminder-rs/config.env ]; then
rm /etc/reminder-rs/config.env
fi
#DEBHELPER#

View File

@ -14,7 +14,7 @@ CREATE TABLE guilds (
default_avatar VARCHAR(512) DEFAULT 'https://raw.githubusercontent.com/reminder-bot/logos/master/Remind_Me_Bot_Logo_PPic.jpg' NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (default_channel_id) REFERENCES reminders.channels(id) ON DELETE SET NULL
FOREIGN KEY (default_channel_id) REFERENCES channels(id) ON DELETE SET NULL
);
CREATE TABLE channels (
@ -35,7 +35,7 @@ CREATE TABLE channels (
guild_id INT UNSIGNED,
PRIMARY KEY (id),
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
);
CREATE TABLE users (
@ -55,7 +55,7 @@ CREATE TABLE users (
patreon BOOLEAN NOT NULL DEFAULT 0,
PRIMARY KEY (id),
FOREIGN KEY (dm_channel) REFERENCES reminders.channels(id) ON DELETE RESTRICT
FOREIGN KEY (dm_channel) REFERENCES channels(id) ON DELETE RESTRICT
);
CREATE TABLE roles (
@ -67,7 +67,7 @@ CREATE TABLE roles (
guild_id INT UNSIGNED NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (guild_id) REFERENCES reminders.guilds(id) ON DELETE CASCADE
FOREIGN KEY (guild_id) REFERENCES guilds(id) ON DELETE CASCADE
);
CREATE TABLE embeds (

View File

@ -88,8 +88,8 @@ async fn main() -> Result<(), Box<dyn StdError + Send + Sync>> {
async fn _main(tx: Sender<()>) -> Result<(), Box<dyn StdError + Send + Sync>> {
env_logger::init();
if Path::new("/etc/reminder-rs/default.env").exists() {
dotenv::from_path("/etc/reminder-rs/default.env")?;
if Path::new("/etc/reminder-rs/config.env").exists() {
dotenv::from_path("/etc/reminder-rs/config.env")?;
}
let discord_token = env::var("DISCORD_TOKEN").expect("Missing DISCORD_TOKEN from environment");

View File

@ -2,6 +2,7 @@
Description=Reminder Bot
[Service]
User=reminder
Type=simple
ExecStart=/usr/bin/reminder-rs
Restart=always