Home folder issues...
This commit is contained in:
Cristhian Martínez Ochoa 2022-11-02 15:09:10 -07:00
parent 8f5252a9e5
commit a12e7279d4
4 changed files with 15 additions and 9 deletions

View file

@ -1,5 +1,9 @@
#!/bin/bash
# Note: We use $HOME here, because it matches the duply/duplicity profile creation folder.
# The profile folder will be stored under '~/.duply/<profile>' (where ~ is the current users home directory).
# Hint: If the folder '/etc/duply' exists, the profiles for the super user root will be searched & created there.
bucket_validation() {
local bucketname=$(echo $1 | cut -d "/" -f 1)

View file

@ -344,7 +344,7 @@ dd_mysql() {
instances:
- server: 127.0.0.1
user: admin
pass: '$ADMIN_PASS'
pass: '$( echo $(conf_read mysql-admin) | openssl enc -d -a -salt )'
port: \"3306\"
options:
replication: false

View file

@ -70,9 +70,6 @@ conf_write() {
# ***********************************************
# Useful variables ****************************
# ***********************************************
ADMIN_PASS=$( echo $(conf_read mysql-admin) | openssl enc -d -a -salt )
[[ -z $ADMIN_PASS ]] && readonly ADMIN_PASS="dUmb" || readonly ADMIN_PASS=$ADMIN_PASS # Never empty, prevent asking password!
# MySQL folder
if [[ $(conf_read db-engine) == "mysql" ]]; then
readonly MYSQL_CONF_PATH="/etc/mysql/mysql.conf.d"
@ -82,10 +79,14 @@ else
readonly MYSQL_CONF_PREF="90"
fi
# Current original user HOME even with sudo (root) - This script always run with sudo, so $HOME is always /root
# https://askubuntu.com/questions/1186999/how-does-sudo-handle-home-differently-since-19-10
readonly CURRENT_HOME=$(eval echo ~${SUDO_USER:-${USER}})
readonly CURRENT_USER=${SUDO_USER:-${USER}}
# Current LoggedIn User!
if [[ -n $(logname) && -d $(eval echo ~$(logname)) ]]; then # You better double check...
readonly CURRENT_HOME=$(eval echo ~$(logname))
readonly CURRENT_USER=$(logname)
else
readonly CURRENT_HOME="/root"
readonly CURRENT_USER="root"
fi
# Check for BASH Shell
# This is a very "shity" method, but checking if file exists is very reliable

View file

@ -324,6 +324,7 @@ fastcgi_param HTTP_ACCEPT_ENCODING "";
sudo sed -i '/USERGROUPS_ENAB/c \USERGROUPS_ENAB no' /etc/login.defs
# Check for dynamic variables.
sudo systemctl restart nginx # We need to kill the process, don't use reload (I don't know why here, but it's needed!)
[[ -n $(conf_read default-response) ]] && sudo webinoly -default-site=$(conf_read default-response)
[[ -n $(conf_read tools-port-set) ]] && sudo webinoly -tools-port=$(conf_read tools-port-set)
[[ -n $(conf_read tools-site) ]] && sudo webinoly -tools-site=$(conf_read tools-site)
@ -380,7 +381,7 @@ location = /xmlrpc.php {
conf_write server-version $svr_version
conf_write nginx-optim true
sudo systemctl restart nginx # We need to kill the process, don't use reload
sudo systemctl reload nginx
api-events_update in10
echo "${gre}Nginx has been successfully Optimized by Webinoly! ${end}"
}