From 46424d7f53016c32620d2765654bcf8712c0823c Mon Sep 17 00:00:00 2001 From: Alexandre CATTEAU Date: Sun, 24 Jul 2022 14:40:56 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + README.md | 11 +++++++++++ bashrc-cloud | 7 +++++++ install.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 bashrc-cloud create mode 100755 install.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a4603f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.disabled diff --git a/README.md b/README.md new file mode 100644 index 0000000..0eb3d8c --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# bashrc-cloud + +Add-on for [main bashrc](https://gitea.kto.black/adminconf/rcs-general), specific to Kloud host. + +### Files +* `bashrc-cloud` should be installed at `~/.bashrc-cloud`. +#### Installation +* `install.sh` script copies above files to their respective destinations. + +### TODO +* RAS diff --git a/bashrc-cloud b/bashrc-cloud new file mode 100644 index 0000000..eb1b9bc --- /dev/null +++ b/bashrc-cloud @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# ~/.bashrc.d/bashrc-cloud +# byMasterKTO + +# Set cloud aliases +alias cloud='sudo -u www-data php /var/www/nextcloud/occ' +alias cloud-update='sudo -u www-data php /var/www/nextcloud/updater/updater.phar' diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..fb86774 --- /dev/null +++ b/install.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +run_directory=$(dirname "$0") +user=$(whoami) + +if [ -f $run_directory/.disabled ]; then + echo "Installation is disabled. Exiting..." + exit 0 +fi + +if [[ $user != 'root' ]]; then + if [ ! -d /home/$user/.bashrc.d ]; then + echo "~/.bashrc.d does not exist. Creating it..." + mkdir /home/$user/.bashrc.d + fi + + echo "Copying bashrc-cloud to extensions directory..." + cp $run_directory/bashrc-cloud /home/$user/.bashrc.d/ +else + if [ ! -d /root/.bashrc.d ]; then + echo "~/.bashrc.d does not exist. Creating it..." + mkdir /root/.bashrc.d + fi + + echo "Copying bashrc-cloud to extensions directory..." + cp $run_directory/bashrc-cloud /root/.bashrc.d/ +fi + +echo "Finished install. Exiting..." +exit 0