Ah
This commit is contained in:
parent
4a8628231c
commit
5e500da16b
15 changed files with 177 additions and 36 deletions
47
config/scripts/bsh
Executable file
47
config/scripts/bsh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# TODO Do not dupplicate trimmed.bash
|
||||
# TODO Remove comments
|
||||
# TODO Do not remove unless last one
|
||||
|
||||
CACHE_DIR="${XDG_CACHE_DIR:-$HOME/.cache}/bsh"
|
||||
FOLDER_NAME="geoffrey"
|
||||
|
||||
|
||||
mkdir -p "$CACHE_DIR"
|
||||
# TODO Update when needed
|
||||
# if [ ! -f "${CACHE_DIR}/cmd" ]
|
||||
if true
|
||||
then
|
||||
# Preparation
|
||||
WORK="${CACHE_DIR}/${FOLDER_NAME}"
|
||||
DEST="/tmp/${FOLDER_NAME}"
|
||||
rm -rf "$WORK" # DEBUG
|
||||
mkdir "$WORK"
|
||||
|
||||
# Copying files
|
||||
cp ~/.config/shell/trimmed.bash "${WORK}/.bashrc"
|
||||
cp ~/.config/inputrc "${WORK}/.inputrc"
|
||||
cp ~/.config/vim/vimconfig.vim "${WORK}/.vimrc"
|
||||
mkdir -p "${WORK}/terminfo/${TERM:0:1}"
|
||||
cp ~/".config/terminfo/${TERM:0:1}/${TERM}" "${WORK}/terminfo/${TERM:0:1}/${TERM}"
|
||||
|
||||
# Extra configuration
|
||||
echo "alias s='sudo -s -E bash --rcfile ${DEST}/.bashrc'" >> "${WORK}/.bashrc"
|
||||
echo "export VIMINIT='source ${DEST}/.vimrc'" >> "${WORK}/.bashrc"
|
||||
echo "export TERMINFO=${DEST}/terminfo" >> "${WORK}/.bashrc"
|
||||
echo "export INPUTRC=${DEST}/.inputrc" >> "${WORK}/.bashrc"
|
||||
# TODO Maybe we should just set HOME there…
|
||||
|
||||
# Crafting command
|
||||
b64="$(cd "$CACHE_DIR"; tar czf - "$FOLDER_NAME" | base64 -w 0)"
|
||||
echo "echo '$b64' | base64 -d | tar xzf - -C /tmp" > "${CACHE_DIR}/cmd"
|
||||
echo "bash --rcfile ${DEST}/.bashrc" >> "${CACHE_DIR}/cmd"
|
||||
echo "rm -rf ${DEST}" >> "${CACHE_DIR}/cmd"
|
||||
|
||||
# Cleanup
|
||||
# rm -rf "$WORK"
|
||||
|
||||
fi
|
||||
|
||||
ssh -t "$@" "$(cat "${CACHE_DIR}/cmd")"
|
Loading…
Add table
Add a link
Reference in a new issue