#!/usr/bin/env miaou-bash # CONSTANTS readonly REQUIRED_PKGS=(file jq vim git) readonly BACKUP='ORIGINAL' # FUNCTIONS function required_packages { "$MIAOU_BASH_DIR/tools/idem_apt_install" "${REQUIRED_PKGS[@]}" } function no_more_skeleton { if [[ -e /etc/skel/.bashrc ]]; then rm /etc/skel/.bashrc echo "skeleton .bashrc removed!" fi } function link_etc { local filename="$1" subfolder="${2:-}" local source="$MIAOU_BASH_DIR/etc" local destination="/etc" [[ -n "$subfolder" ]] && source+="/${subfolder}" && destination+="/${subfolder}" if [[ -L "$destination/$filename" ]]; then if [[ "$(readlink "$destination/$filename")" != "$source/$filename" ]]; then ln -sf "$source/$filename" "$destination" echo "link $source/$filename updated" fi else if [[ -f "$destination/$filename" ]]; then mv "$destination/$filename" "$destination/$filename.$BACKUP" echo "$destination/$filename.$BACKUP saved!" fi ln -s "$source/$filename" "$destination" echo "link $source/$filename created" fi } function predefine_config_files { link_etc bash.bashrc link_etc inputrc link_etc vimrc.azerty vim link_etc vimrc.core vim link_etc vimrc.local vim link_etc vimrc.miaou vim link_etc vimrc.rookie vim } # MAIN [ "$UID" -ne 0 ] && echo 'root privilege required' && exit 1 source "$MIAOU_BASH_DIR/lib/functions.bash" required_packages no_more_skeleton predefine_config_files