mirror of
https://github.com/Matir/skel.git
synced 2026-05-26 13:35:42 -07:00
Merge branch 'master' of https://github.com/Matir/skel
This commit is contained in:
71
install.sh
71
install.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set nounset
|
set -o nounset
|
||||||
set errexit
|
set -o errexit
|
||||||
|
|
||||||
function prerequisites {
|
function prerequisites {
|
||||||
if which zsh > /dev/null 2>&1 ; then
|
if which zsh > /dev/null 2>&1 ; then
|
||||||
@@ -55,15 +55,16 @@ function install_git {
|
|||||||
if ! which git > /dev/null ; then
|
if ! which git > /dev/null ; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local REPO="${1}"
|
local REPO="${*: -2:1}"
|
||||||
local DESTDIR="${2}"
|
local DESTDIR="${*: -1:1}"
|
||||||
|
set ${*:1:-2}
|
||||||
if [[ -d ${DESTDIR}/.git ]] ; then
|
if [[ -d ${DESTDIR}/.git ]] ; then
|
||||||
( cd ${DESTDIR} ; git pull -q )
|
( cd ${DESTDIR} ; git pull -q )
|
||||||
else
|
else
|
||||||
if [[ ${MINIMAL} -eq 1 ]] ; then
|
if [[ ${MINIMAL} -eq 1 ]] ; then
|
||||||
git clone --depth 1 ${REPO} ${DESTDIR}
|
git clone --depth 1 $* ${REPO} ${DESTDIR}
|
||||||
else
|
else
|
||||||
git clone ${REPO} ${DESTDIR}
|
git clone $* ${REPO} ${DESTDIR}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -82,7 +83,7 @@ function install_pwndbg {
|
|||||||
if ! which gdb > /dev/null 2>&1 ; then
|
if ! which gdb > /dev/null 2>&1 ; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
install_git https://github.com/pwndbg/pwndbg.git $HOME/.pwndbg
|
install_git -b stable https://github.com/pwndbg/pwndbg.git $HOME/.pwndbg
|
||||||
mkdir -p $HOME/.pwndbg/vendor
|
mkdir -p $HOME/.pwndbg/vendor
|
||||||
local PYVER=$(gdb -batch -q --nx -ex 'pi import platform; print(".".join(platform.python_version_tuple()[:2]))')
|
local PYVER=$(gdb -batch -q --nx -ex 'pi import platform; print(".".join(platform.python_version_tuple()[:2]))')
|
||||||
local PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
|
local PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
|
||||||
@@ -95,8 +96,6 @@ function install_pwndbg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function postinstall {
|
function postinstall {
|
||||||
install_pwndbg
|
|
||||||
|
|
||||||
# Install Vundle plugins
|
# Install Vundle plugins
|
||||||
if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then
|
if [[ -d $HOME/.vim/bundle/Vundle.vim ]] ; then
|
||||||
vim +VundleInstall +qall
|
vim +VundleInstall +qall
|
||||||
@@ -282,13 +281,32 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
function verbose {
|
function verbose {
|
||||||
(( ${VERBOSE:-0} )) && echo "$@" >&2
|
(( ${VERBOSE:-0} )) && echo "$@" >&2 || return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Operations
|
||||||
|
|
||||||
|
function install_main {
|
||||||
|
(( $MINIMAL )) || prerequisites
|
||||||
|
(( $INSTALL_PKGS )) && is_deb_system && install_apt_pkgs
|
||||||
|
install_dotfile_dir "${BASEDIR}/dotfiles"
|
||||||
|
test -d "${BASEDIR}/private_dotfiles" && \
|
||||||
|
test -d "${BASEDIR}/.git/git-crypt" && \
|
||||||
|
install_dotfile_dir "${BASEDIR}/private_dotfiles"
|
||||||
|
test -d "${BASEDIR}/local_dotfiles" && \
|
||||||
|
install_dotfile_dir "${BASEDIR}/local_dotfiles"
|
||||||
|
install_basic_dir "${BASEDIR}/bin" "${HOME}/bin"
|
||||||
|
(( $MINIMAL )) || postinstall
|
||||||
|
(( $INSTALL_KEYS )) && install_keys
|
||||||
|
save_prefs
|
||||||
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
# Setup variables
|
# Setup variables
|
||||||
read_saved_prefs
|
read_saved_prefs
|
||||||
|
|
||||||
# Defaults if not passed in or saved
|
# Defaults if not passed in or saved.
|
||||||
|
# TODO: use flags instead of environment variables.
|
||||||
BASEDIR=${BASEDIR:-$HOME/.skel}
|
BASEDIR=${BASEDIR:-$HOME/.skel}
|
||||||
MINIMAL=${MINIMAL:-0}
|
MINIMAL=${MINIMAL:-0}
|
||||||
INSTALL_KEYS=${INSTALL_KEYS:-1}
|
INSTALL_KEYS=${INSTALL_KEYS:-1}
|
||||||
@@ -311,20 +329,23 @@ else
|
|||||||
HAVE_X=0
|
HAVE_X=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IS_KALI=`grep -ci kali /etc/os-release 2>/dev/null`
|
IS_KALI=`grep -ci kali /etc/os-release 2>/dev/null || true`
|
||||||
ARCH=`uname -m`
|
ARCH=`uname -m`
|
||||||
|
|
||||||
|
OPERATION=${1:-install}
|
||||||
|
|
||||||
(( $MINIMAL )) || prerequisites
|
case $OPERATION in
|
||||||
(( $INSTALL_PKGS )) && is_deb_system && install_apt_pkgs
|
install)
|
||||||
install_dotfile_dir "${BASEDIR}/dotfiles"
|
install_main
|
||||||
test -d "${BASEDIR}/private_dotfiles" && \
|
;;
|
||||||
test -d "${BASEDIR}/.git/git-crypt" && \
|
package*)
|
||||||
install_dotfile_dir "${BASEDIR}/private_dotfiles"
|
install_pkg_set packages.${2}
|
||||||
test -d "${BASEDIR}/local_dotfiles" && \
|
;;
|
||||||
install_dotfile_dir "${BASEDIR}/local_dotfiles"
|
pwndbg)
|
||||||
install_basic_dir "${BASEDIR}/bin" "${HOME}/bin"
|
install_pwndbg
|
||||||
(( $MINIMAL )) || postinstall
|
;;
|
||||||
(( $INSTALL_KEYS )) && install_keys
|
*)
|
||||||
save_prefs
|
echo "Unknown operation $OPERATION." >/dev/stderr
|
||||||
cleanup
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user