diff options
author | TomZ | 2018-03-08 16:38:52 +0100 |
---|---|---|
committer | TomZ | 2018-03-08 19:56:45 +0100 |
commit | 32d62b7d7e740d87f291f9cefa3b88fa781aa21f (patch) | |
tree | dd34c151326cc3eb577d100927e1e75e9d14f306 /flowee.install | |
parent | b54211026369e580259f20954ef963afb7b9435e (diff) | |
download | aur-32d62b7d7e740d87f291f9cefa3b88fa781aa21f.tar.gz |
Make this actually compile and install Flowee.
This is a 'git' build.
Diffstat (limited to 'flowee.install')
-rw-r--r-- | flowee.install | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/flowee.install b/flowee.install new file mode 100644 index 000000000000..694e989c2540 --- /dev/null +++ b/flowee.install @@ -0,0 +1,49 @@ +_bc_user=flowee +_bc_group=flowee + +post_install() { + _mkuser + _dir="/var/lib/flowee" + _log="/var/log/flowee" + _cnf="/etc/flowee" + if test ! -d "$_dir"; then + mkdir -m 750 "$_dir" + # disable Copy-On-Write (btrfs directories only) + # This avoids lots of known db-corruption issues + _is_btrfs "$_dir" && chattr +C "$_dir" + fi + mkdir -p -m 770 "$_log" + chown -R $_bc_user:$_bc_group "$_dir" "$_cnf" "$_log" +} + +post_upgrade() { + _mkuser +} + + +# ------------------------------------------------------------------------------ +# helper functions for creating flowee user / group +# ------------------------------------------------------------------------------ + +_mkuser() { + getent passwd $_bc_user &>/dev/null || { + echo -n "Creating flowee user... " + grep -E "^$_bc_group:" /etc/group >/dev/null || groupadd $_bc_group + useradd -m -d /etc/flowee -g $_bc_group -s /usr/bin/nologin $_bc_user 2>/dev/null + echo "done" + } +} + +# ------------------------------------------------------------------------------ +# helper functions for disabling btrfs Copy-On-Write (CoW) +# https://wiki.archlinux.org/index.php/Btrfs#Copy-On-Write_.28CoW.29 +# ------------------------------------------------------------------------------ + +# check if dir is btrfs +_is_btrfs() { + if [[ $(findmnt --target $1 --output FSTYPE --noheadings) == 'btrfs' ]]; then + return 0 + else + return 1 + fi +} |