You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
906 B
39 lines
906 B
#!/bin/bash
|
|
|
|
# CONSTANTS
|
|
|
|
MIAOU_BASH_DIR=${MIAOU_BASH_DIR:-/opt/miaou-bash}
|
|
ORIGINAL="ORIGINAL"
|
|
PREDEFINED_CONFIG_FILES=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc)
|
|
readonly MIAOU_BASH_DIR ORIGINAL
|
|
|
|
# FUNCTIONS
|
|
|
|
function no_more_skeleton {
|
|
[[ -e /etc/skel/.bashrc ]] && rm /etc/skel/.bashrc && echo "skeleton .bashrc removed!"
|
|
}
|
|
|
|
function predefine_config_files {
|
|
for i in "${PREDEFINED_CONFIG_FILES[@]}"; do
|
|
if [[ -f "$i" ]] && [[ ! -f "$i.$ORIGINAL" ]]; then
|
|
mv "$i" "$i.$ORIGINAL"
|
|
basefile=$(basename "$i")
|
|
ln -s "$MIAOU_BASH_DIR/$basefile" "$i"
|
|
fi
|
|
done
|
|
}
|
|
|
|
function bin_miaou_bash {
|
|
[[ ! -e /usr/bin/miaou-bash ]] &&
|
|
ln -s "$MIAOU_BASH_DIR/bin/miaou-bash" /usr/bin/ &&
|
|
echo "miaou-bash globally defined!"
|
|
}
|
|
|
|
# MAIN
|
|
|
|
set -TEeu -o pipefail
|
|
[ "$(id -u)" -ne 0 ] && echo 'root privilege required' && exit 1
|
|
|
|
no_more_skeleton
|
|
predefine_config_files
|
|
bin_miaou_bash
|