Compare commits
2 Commits
fdb5d070e4
...
391b85bea5
Author | SHA1 | Date | |
---|---|---|---|
391b85bea5 | |||
e24f3337a1 |
@ -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}"
|
||||
done
|
||||
. "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/terminal_fancyfying_${TERMINAL_FANCYFY}"
|
||||
|
45
deploy.sh
45
deploy.sh
@ -1,14 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
THIS="$(dirname "$(readlink -fm "$0")")"
|
||||
SERVER=false
|
||||
FANCYFY="client"
|
||||
CURRENT_FANCYFY=""
|
||||
DELETE=false
|
||||
MOVE=false
|
||||
PRESENT=false
|
||||
|
||||
_bashrc_present() {
|
||||
if [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
|
||||
echo true
|
||||
exit
|
||||
fi
|
||||
echo false
|
||||
}
|
||||
|
||||
_arguments() {
|
||||
if [ "$(_bashrc_present)" = true ]; then
|
||||
PRESENT=true
|
||||
CURRENT_FANCYFY="$(grep TERMINAL_FANCYFY /home/bryanpedini/.bashrc | sed 's/.*=//')"
|
||||
fi
|
||||
for PARM in "$@"; do
|
||||
if [ "${PARM}" = "--server" ]; then
|
||||
SERVER=true
|
||||
FANCYFY="server"
|
||||
elif [ "${PARM}" = "--delete" ]; then
|
||||
DELETE=true
|
||||
elif [ "${PARM}" = "--move" ]; then
|
||||
@ -38,12 +52,12 @@ _help() {
|
||||
}
|
||||
|
||||
_delete() {
|
||||
sed -i '/REF:bashrc_overrides:REF/{N;d}' ~/.bashrc
|
||||
sed -i '/REF:bashrc_overrides:REF/{N;N;d}' ~/.bashrc
|
||||
}
|
||||
|
||||
_bashrc_ref() {
|
||||
echo "#REF:bashrc_overrides:REF" >> ~/.bashrc
|
||||
echo "export TERMINAL_FANCYFY=client" >> ~/.bashrc
|
||||
echo "export TERMINAL_FANCYFY=${1}" >> ~/.bashrc
|
||||
echo ". ${THIS}/bashrc_overrides/_all" >> ~/.bashrc
|
||||
}
|
||||
|
||||
@ -57,23 +71,26 @@ _main() {
|
||||
|
||||
if [ "${DELETE}" = true ]; then
|
||||
_delete
|
||||
echo "removed custom configs"
|
||||
elif [ "${MOVE}" = true ]; then
|
||||
_move
|
||||
elif [ ! -z "$(grep "#REF:bashrc_overrides:REF" ~/.bashrc)" ]; then
|
||||
echo "bash overrides already in place"
|
||||
echo "skipping..."
|
||||
echo "moved custom config directory to ${THIS}"
|
||||
echo
|
||||
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 "skipping..."
|
||||
echo
|
||||
fi
|
||||
else
|
||||
_bashrc_ref
|
||||
_bashrc_ref "${FANCYFY}"
|
||||
echo "bash overrides added"
|
||||
echo
|
||||
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 "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user