summarylogtreecommitdiffstats
path: root/bs.install
diff options
context:
space:
mode:
Diffstat (limited to 'bs.install')
-rw-r--r--bs.install94
1 files changed, 9 insertions, 85 deletions
diff --git a/bs.install b/bs.install
index 93aa3a459f76..e13210f6dfe6 100644
--- a/bs.install
+++ b/bs.install
@@ -1,95 +1,19 @@
-_bs_user=bs
-_bs_group=bs
+_bs_user=obelisk
+_bs_group=obelisk
post_install() {
- _mkuser
- # disable Copy-On-Write (btrfs directories only)
- for _dir in /srv/bs /var/log/bs; do
- _is_btrfs "$_dir" && _disable_cow "$_dir"
- done
- chown -R $_bs_user:$_bs_group /etc/bs /srv/bs /var/log/bs
+ chown -R $_bs_user:$_bs_group /etc/obelisk/bs /var/log/obelisk/bs
printf "%b\n" "$obelisk"
}
post_upgrade() {
- _mkuser
- chown -R $_bs_user:$_bs_group /etc/bs /srv/bs /var/log/bs
- printf "%b\n" "$obelisk"
+ post_install
}
post_remove() {
- _rmuser
- rm -rf /etc/bs /srv/bs /var/log/bs
-}
-
-
-# ------------------------------------------------------------------------------
-# helper functions for creating libbitcoin-server user / group
-# ------------------------------------------------------------------------------
-
-_mkuser() {
- getent passwd $_bs_user &>/dev/null || {
- echo -n "Creating libbitcoin-server user... "
- grep -E "^$_bs_group:" /etc/group >/dev/null || groupadd $_bs_group
- useradd -m -d /etc/bs -g $_bs_group -s /usr/bin/nologin $_bs_user
- echo "done"
- }
-}
-
-_rmuser() {
- echo -n "Removing libbitcoin-server user... "
- userdel -rf $_bs_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
+ rm -rf /etc/obelisk/bs /var/log/obelisk/bs
}
-# disable btrfs CoW
-_chattrify() {
- # original dir, with trailing slash stripped if it exists
- _orig_dir=$( echo "$1" | sed 's@/$@@' )
-
- # if original dir exists, back it up
- [[ -d "$1" ]] && mv "$1" "${_orig_dir}"_old
-
- # re-make original dir
- mkdir -p "$1"
-
- # set permissions on re-made dir
- chmod "$2" "$1"
-
- # disable btrfs CoW on re-made dir
- chattr +C "$1"
-
- # recursive copy to restore backed up dir while maintaining disabled CoW
- [[ -d "${_orig_dir}"_old ]] \
- && find "${_orig_dir}"_old -mindepth 1 -maxdepth 1 -exec cp -R '{}' "$1" \;
-
- # set ownership on re-made dir
- chown -R $3:$4 "$1"
-
- # purge backed up dir
- [[ -d "${_orig_dir}"_old ]] && rm -rf "${_orig_dir}"_old
-}
-
-_disable_cow() {
- _chattrify "$1" "755" "$_bs_user" "$_bs_group"
-}
-
-
read -d '' obelisk <<'EOF'
########################################################################
########################################################################
@@ -99,14 +23,14 @@ read -d '' obelisk <<'EOF'
## ##
## To run: ##
## ##
-## systemctl start bsinit # first run only ##
+## systemctl start bs-init # first run only ##
## systemctl start bs ##
## ##
## ##
-## Config: /etc/bs/bs.cfg ##
-## Blockchain: /srv/bs ##
+## Config: /etc/obelisk/bs/bs.cfg ##
+## Blockchain: /srv/obelisk ##
## Documentation: /usr/share/doc/libbitcoin-server ##
-## Logs: /var/log/bs ##
+## Logs: /var/log/obelisk/bs ##
## ##
########################################################################
########################################################################