From 8c6f63a9d2affba291640f56d0060419f24ac435 Mon Sep 17 00:00:00 2001 From: pvincent Date: Thu, 22 Jun 2023 12:10:16 +0400 Subject: [PATCH] init.sh --- init.sh | 22 ++++++++++++++++++++++ install.sh | 21 +-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) create mode 100755 init.sh diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..15d2a9a --- /dev/null +++ b/init.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -Eeuo pipefail + +#remove /etc/skel/.bashrc +if [ -e /etc/skel/.bashrc ]; then + rm /etc/skel/.bashrc +fi + +ORIGINAL="ORIGINAL" +declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc) + +for i in "${arr[@]}"; do + if [ ! -f "$i.$ORIGINAL" ]; then + + echo "$i needs installation $(basename $i)" + mv "$i" "$i.$ORIGINAL" + ln -s "$CURDIR/$(basename $i)" "$i" + else + echo "<$i> already overriden!" + fi +done diff --git a/install.sh b/install.sh index eba06c8..42f3103 100755 --- a/install.sh +++ b/install.sh @@ -36,28 +36,9 @@ function install_host() { fi else - - #remove /etc/skel/.bashrc - if [ -e /etc/skel/.bashrc ]; then - rm /etc/skel/.bashrc - fi - - ORIGINAL="ORIGINAL" - declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc) - - for i in "${arr[@]}"; do - if [ ! -f "$i.$ORIGINAL" ]; then - - echo "$i needs installation $(basename $i)" - mv "$i" "$i.$ORIGINAL" - ln -s "$CURDIR/$(basename $i)" "$i" - else - echo "$i" already overriden - fi - done - apt-get update apt-get install -y "${REQUIRED_PKGS[@]}" + ./init.sh fi }