6 Commits

Author SHA1 Message Date
dc984eb128 removed network host from sambaserver, fixed samba options 2023-12-17 12:33:18 +01:00
5d6c22f1b8 added infinitenothing alias 2023-12-17 12:32:32 +01:00
c53a382a4f fixed typo in bashrc path, variabilized bashrc path 2023-12-14 15:13:51 +01:00
bcaffe612c fixed move function in deploy.sh 2023-12-14 15:07:11 +01:00
391b85bea5 fixed new fancyfy scheme in deploy.sh 2023-12-14 15:02:45 +01:00
e24f3337a1 fixed terminal_fancyfy not working for server
excluded fancyfy from source in for loop
added sourcing only the correct file
2023-12-14 14:24:21 +01:00
3 changed files with 50 additions and 22 deletions

View File

@@ -1,3 +1,4 @@
for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -v "_all"); do for source in $(find "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" -type f | grep -Ev "_all|terminal_fancyfying"); do
. "${source}" . "${source}"
done done
. "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/terminal_fancyfying_${TERMINAL_FANCYFY}"

View File

@@ -8,8 +8,9 @@ alias sshfingerprint='ssh-keygen -lf'
alias nocomments='grep -vE "^$|^#|^;"' alias nocomments='grep -vE "^$|^#|^;"'
alias newrepo='bash <(curl -s https://get.bjphoster.com/new-git-repo.sh)' alias newrepo='bash <(curl -s https://get.bjphoster.com/new-git-repo.sh)'
alias newansibleworkspace='bash <(curl -s https://get.bjphoster.com/new-ansible-workspace.sh)' alias newansibleworkspace='bash <(curl -s https://get.bjphoster.com/new-ansible-workspace.sh)'
alias infinitenothing='while true; do sleep 1; done'
alias sambaserver='docker run -it --rm --network host -p 137:137 -p 138:138 -p 139:139 -p 445:445 -v `pwd`:/share dperson/samba -n -p -s "sambashare;/share;yes;no;no;shareuser" -w "WORKGROUP"' alias sambaserver='docker run -it --rm -p 137:137 -p 138:138 -p 139:139 -p 445:445 -v `pwd`:/share dperson/samba -n -p -s "share;/share;yes;no;yes" -w "WORKGROUP"'
alias acme.sh='docker run -it --rm -v ~/acme.sh:/acme.sh neilpang/acme.sh' alias acme.sh='docker run -it --rm -v ~/acme.sh:/acme.sh neilpang/acme.sh'
alias termbin='nc termbin.com 9999' alias termbin='nc termbin.com 9999'
alias dnsversion='dig txt chaos version.bind' alias dnsversion='dig txt chaos version.bind'

View File

@@ -1,14 +1,29 @@
#!/usr/bin/env bash #!/usr/bin/env bash
THIS="$(dirname "$(readlink -fm "$0")")" THIS="$(dirname "$(readlink -fm "$0")")"
SERVER=false FANCYFY="client"
CURRENT_FANCYFY=""
DELETE=false DELETE=false
MOVE=false MOVE=false
PRESENT=false
BASHRC="~/.bashrc"
_bashrc_present() {
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ${BASHRC})" ]; then
echo true
exit
fi
echo false
}
_arguments() { _arguments() {
if [ "$(_bashrc_present)" = true ]; then
PRESENT=true
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY ${BASHRC} | sed 's/.*=//')"
fi
for PARM in "$@"; do for PARM in "$@"; do
if [ "${PARM}" = "--server" ]; then if [ "${PARM}" = "--server" ]; then
SERVER=true FANCYFY="server"
elif [ "${PARM}" = "--delete" ]; then elif [ "${PARM}" = "--delete" ]; then
DELETE=true DELETE=true
elif [ "${PARM}" = "--move" ]; then elif [ "${PARM}" = "--move" ]; then
@@ -29,7 +44,7 @@ _help() {
echo " --force" echo " --force"
echo " Force the reinstallation of the files" echo " Force the reinstallation of the files"
echo " --delete" echo " --delete"
echo " Delete the reference in ~/.bashrc" echo " Delete the reference in ${BASHRC}"
echo " --move" echo " --move"
echo " Create a new reference if the location of this folder has been changed" echo " Create a new reference if the location of this folder has been changed"
echo " --server" echo " --server"
@@ -38,18 +53,18 @@ _help() {
} }
_delete() { _delete() {
sed -i '/REF:bashrc_overrides:REF/{N;d}' ~/.bashrc sed -i '/REF:bashrc_overrides:REF/{N;N;d}' "${BASHRC}"
} }
_bashrc_ref() { _bashrc_ref() {
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc echo "#REF:bashrc_overrides:REF" >> "${BASHRC}"
echo "export TERMINAL_FANCYFY=client" >> ~/.bashrc echo "export TERMINAL_FANCYFY=${1}" >> "${BASHRC}"
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc echo ". ${THIS}/bashrc_overrides/_all" >> "${BASHRC}"
} }
_move() { _move() {
_delete _delete
_bashrc_ref _bashrc_ref "${FANCYFY}"
} }
_main() { _main() {
@@ -57,23 +72,34 @@ _main() {
if [ "${DELETE}" = true ]; then if [ "${DELETE}" = true ]; then
_delete _delete
echo "removed custom configs"
elif [ "${MOVE}" = true ]; then elif [ "${MOVE}" = true ]; then
if [ "${PRESENT}" = false ]; then
_bashrc_ref "${FANCYFY}"
echo "unable to move to current directory"
echo "bash overrides not previously present"
echo "adding bash overrides..."
echo
else
_move _move
elif [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then echo "moved custom config directory to ${THIS}"
echo
fi
elif [ "${PRESENT}" = true ]; then
if [ "${CURRENT_FANCYFY}" != "${FANCYFY}" ]; then
sed -i "s/TERMINAL_FANCYFY=${CURRENT_FANCYFY}/TERMINAL_FANCYFY=${FANCYFY}/" "${BASHRC}"
echo "customized fancyfying"
echo
else
echo "bash overrides already in place" echo "bash overrides already in place"
echo "skipping..." echo "skipping..."
echo echo
fi
else else
_bashrc_ref _bashrc_ref "${FANCYFY}"
echo "bash overrides added" echo "bash overrides added"
echo echo
fi fi
if [ "${SERVER}" = true ]; then
sed -i 's/terminal_fancyfying/terminal_fancyfying_server/' ${THIS}/bashrc_overrides/_all
else
sed -i 's/terminal_fancyfying_server/terminal_fancyfying/' ${THIS}/bashrc_overrides/_all
fi
} }
_main "$@" _main "$@"