no more home bin, add script package to PATH
This commit is contained in:
@@ -3,5 +3,4 @@
|
||||
/Config.ps1
|
||||
/crons/*.status
|
||||
/distinct/*.msg
|
||||
/git-prompt.sh
|
||||
/ssh
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# the command used to initialize our partial subtree
|
||||
#git remote add -f -t master --no-tags gitprompt https://github.com/git/git.git
|
||||
#git read-tree --prefix=git-prompt/ -u gitprompt/master:contrib/completion
|
||||
#git commit
|
||||
|
||||
# the command used to update our partial subtree
|
||||
git rm -rf git-prompt
|
||||
git read-tree --prefix=git-prompt/ -u gitprompt/master:contrib/completion
|
||||
git commit
|
||||
|
||||
@@ -26,91 +26,3 @@ case "${response}" in
|
||||
esac
|
||||
echo ''
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
read -p 'Install scripts into your ~/bin? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
# setup symlinks, if not installed in users bin directory
|
||||
# need absolute path, so the symbolic links will be created correctly.
|
||||
script_dir=$(readlink -f "$0" | xargs dirname | xargs dirname)
|
||||
|
||||
# --- home bin folder ---
|
||||
if [[ ! -d "${HOME}/bin" ]]; then
|
||||
echo 'making personal bin directory'
|
||||
mkdir -p "${HOME}/bin"
|
||||
fi
|
||||
|
||||
# --- general scripts ---
|
||||
if [[ ! -f "${HOME}/bin/4-public-ip.sh" ]]; then
|
||||
echo 'installing 4-public-ip.sh'
|
||||
ln -s "${script_dir}/4-public-ip.sh" "${HOME}/bin/4-public-ip.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/6-public-ip.sh" ]]; then
|
||||
echo 'installing 6-public-ip.sh'
|
||||
ln -s "${script_dir}/6-public-ip.sh" "${HOME}/bin/6-public-ip.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/docker-ps.sh" ]]; then
|
||||
echo 'installing docker-ps.sh'
|
||||
ln -s "${script_dir}/docker-ps.sh" "${HOME}/bin/docker-ps.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/delay.sh" ]]; then
|
||||
echo 'installing delay.sh'
|
||||
ln -s "${script_dir}/delay.sh" "${HOME}/bin/delay.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/enumerate.sh" ]]; then
|
||||
echo 'installing enumerate.sh'
|
||||
ln -s "${script_dir}/enumerate.sh" "${HOME}/bin/enumerate.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/is-restart-needed.sh" ]]; then
|
||||
echo 'installing is-restart-needed.sh'
|
||||
ln -s "${script_dir}/is-restart-needed.sh" "${HOME}/bin/is-restart-needed.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/named-cat.sh" ]]; then
|
||||
echo 'installing named-cat.sh'
|
||||
ln -s "${script_dir}/named-cat.sh" "${HOME}/bin/named-cat.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/restart-if-needed.sh" ]]; then
|
||||
echo 'installing restart-if-needed.sh'
|
||||
ln -s "${script_dir}/restart-if-needed.sh" "${HOME}/bin/restart-if-needed.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/upgrade.sh" ]]; then
|
||||
echo 'installing upgrade.sh'
|
||||
ln -s "${script_dir}/upgrade.sh" "${HOME}/bin/upgrade.sh"
|
||||
fi
|
||||
|
||||
# --- git related scripts ---
|
||||
if [[ ! -f "${HOME}/bin/fetch-all.sh" ]]; then
|
||||
echo 'installing fetch-all.sh'
|
||||
ln -s "${script_dir}/fetch-all.sh" "${HOME}/bin/fetch-all.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/list-all.sh" ]]; then
|
||||
echo 'installing list-all.sh'
|
||||
ln -s "${script_dir}/list-all.sh" "${HOME}/bin/list-all.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/pull-all.sh" ]]; then
|
||||
echo 'installing pull-all.sh'
|
||||
ln -s "${script_dir}/pull-all.sh" "${HOME}/bin/pull-all.sh"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${HOME}/bin/status-all.sh" ]]; then
|
||||
echo 'installing status-all.sh'
|
||||
ln -s "${script_dir}/status-all.sh" "${HOME}/bin/status-all.sh"
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
;;
|
||||
esac
|
||||
echo ''
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
called_backup=false
|
||||
called_update=false
|
||||
curdate=$(date '+%Y-%m-%d')
|
||||
script_dir=$(dirname "$0")
|
||||
# absolute path to this scripts parent directory (package root)
|
||||
package_dir=$(readlink -f "$0" | xargs dirname | xargs dirname)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
@@ -26,6 +30,39 @@ function install_collection () {
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
# call this function before editing bashrc, will only make backup if needed
|
||||
function make_bashrc_backup () {
|
||||
if [ "${called_backup}" = false ]; then
|
||||
called_backup=true
|
||||
if [[ ! -f "${HOME}/bashrc.backup.${curdate}" ]]; then
|
||||
echo 'backing up existing bashrc'
|
||||
cp "${HOME}/.bashrc" "${HOME}/bashrc.backup.${curdate}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
read -p 'Configure PATH for scripts in this package? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
make_bashrc_backup
|
||||
( cat << BASHRC
|
||||
|
||||
# ABS include shell scripts
|
||||
export PATH="${package_dir}:\$PATH"
|
||||
|
||||
BASHRC
|
||||
) >> "${HOME}/.bashrc"
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
;;
|
||||
esac
|
||||
echo ''
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
install_collection 'core utilities: (curl, python3, jq, htop, etc.)' curl fail2ban git htop jq grep gzip net-tools goaccess dnsutils bash-completion cron vim make chrony build-essential gcc inotify-tools python3 python-is-python3 screen bc
|
||||
|
||||
# ----------------------------------------------------------
|
||||
@@ -41,15 +78,15 @@ install_collection 'Ruby: (ruby, build-essential)' ruby-full build-essential zli
|
||||
read -p 'Configure GEM_HOME and PATH for Ruby support? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
make_bashrc_backup
|
||||
( cat << 'BASHRC'
|
||||
|
||||
# Install Ruby Gems to ~/gems
|
||||
# ABS configure ruby gems
|
||||
export GEM_HOME="$HOME/gems"
|
||||
export PATH="$HOME/gems/bin:$PATH"
|
||||
|
||||
BASHRC
|
||||
) >> "${HOME}/.bashrc"
|
||||
show_note=true
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
@@ -90,6 +127,7 @@ echo ''
|
||||
read -p 'Install GoLang? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
make_bashrc_backup
|
||||
sudo apt install wget jq -y
|
||||
# load json file with version info, filter to only stable versions, take the first (newest), strip to just numeric
|
||||
version_flag=''
|
||||
|
||||
+8
-11
@@ -3,6 +3,8 @@
|
||||
called_backup=false
|
||||
curdate=$(date '+%Y-%m-%d')
|
||||
script_dir=$(dirname "$0")
|
||||
# absolute path to this scripts parent directory (package root)
|
||||
package_dir=$(readlink -f "$0" | xargs dirname | xargs dirname)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
@@ -23,18 +25,13 @@ read -p 'Install git-prompt and include in ~/.bashrc? [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
make_bashrc_backup
|
||||
sudo apt install wget jq -y
|
||||
# make home bin folder if needed
|
||||
[ ! -d "${HOME}/bin" ] && mkdir "${HOME}/bin"
|
||||
# download git-prompt
|
||||
wget 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh' -O "${HOME}/bin/git-prompt.sh" -q && ( cat << 'BASHRC'
|
||||
( cat << BASHRC
|
||||
|
||||
# ABS git prompt
|
||||
source ~/bin/git-prompt.sh
|
||||
# ABS include git prompt
|
||||
source ${package_dir}/git-prompt.sh
|
||||
|
||||
BASHRC
|
||||
) >> "${HOME}/.bashrc"
|
||||
chmod +x "${HOME}/bin/git-prompt.sh"
|
||||
;;
|
||||
* )
|
||||
echo 'Skipping'
|
||||
@@ -165,12 +162,12 @@ echo ''
|
||||
|
||||
# ----------------------------------------------------------
|
||||
|
||||
read -p 'Set "ssh" alias to ssh-ident"? (and set python3 as python) [y/N]: ' response
|
||||
read -p 'Set "ssh" symlink to "ssh-ident"? (and set python3 as python) [y/N]: ' response
|
||||
case "${response}" in
|
||||
[Yy]* )
|
||||
sudo apt install python-is-python3 -y
|
||||
if [[ ! -f "${HOME}/bin/ssh" ]]; then
|
||||
ln -s "${script_dir}/ssh-ident" "${HOME}/bin/ssh"
|
||||
if [[ ! -f "${script_dir}/../ssh" ]]; then
|
||||
ln -s './ssh-ident' "${script_dir}/../ssh"
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
|
||||
Reference in New Issue
Block a user