Compare commits
8 Commits
ca3d62952d
...
d396e06e4e
Author | SHA1 | Date |
---|---|---|
David Todd | d396e06e4e | |
David Todd | fa1ac68a70 | |
David Todd | 10de77b77e | |
David Todd | 635cb655be | |
David Todd | cea6f93354 | |
David Todd | fdb3222bcb | |
David Todd | 56671a8b7f | |
David Todd | 351b67de1e |
14
.environment
14
.environment
|
@ -15,28 +15,28 @@ export PATH=${HOME}/bin:$PATH:/usr/lib/wine/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||||
# Give the path to the dotfiles
|
# Give the path to the dotfiles
|
||||||
export _DOTFILES="${HOME}/dotfiles"
|
export _DOTFILES="${HOME}/dotfiles"
|
||||||
|
|
||||||
# Allow automatic updates
|
# Allow checking for automatic updates
|
||||||
export DISABLE_DOTFILES_AUTO_UPDATE="FALSE"
|
export ENABLE_DOTFILES_AUTO_UPDATE=true
|
||||||
|
|
||||||
# Set "true" to update without asking first
|
# Set "true" to update without asking first
|
||||||
export DISABLE_DOTFILES_UPDATE_PROMPT="FALSE"
|
export DISABLE_DOTFILES_UPDATE_PROMPT=false
|
||||||
|
|
||||||
# Update every 2 weeks (OMZ default)
|
# Update every 2 weeks (OMZ default)
|
||||||
export UPDATE_DOTFILES_DAYS=13
|
export UPDATE_DOTFILES_DAYS=13
|
||||||
|
|
||||||
# Whether or not to automatically connect to a TMUX session when opening the shell
|
# Whether or not to automatically connect to a TMUX session when opening the shell
|
||||||
export ENABLE_TMUXAC="FALSE"
|
export ENABLE_TMUXAC=false
|
||||||
|
|
||||||
# If there is not an active tmux session, we probably want one
|
# If there is not an active tmux session, we probably want one
|
||||||
# Otherwise, the shell will not open the session again (eg. opening tabs, new terminals)
|
# Otherwise, the shell will not open the session again (eg. opening tabs, new terminals)
|
||||||
if $(tmux list-sessions >> /dev/null 2>&1); then
|
if $(tmux list-sessions >> /dev/null 2>&1); then
|
||||||
export TMUXATT="TRUE"
|
export TMUXATT=true
|
||||||
else
|
else
|
||||||
export TMUXATT="FALSE"
|
export TMUXATT=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Automatically attach tmux session "C0DE"
|
# Automatically attach tmux session "C0DE"
|
||||||
if [[ -z "$TMUX" && "$TMUXATT" != "TRUE" && "$ENABLE_TMUXAC" != "FALSE" ]]; then
|
if [[ -z "$TMUX" && "$TMUXATT" && "$ENABLE_TMUXAC" ]]; then
|
||||||
tmux attach -t C0DE || tmux new -s C0DE
|
tmux attach -t C0DE || tmux new -s C0DE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
17
.zshrc
17
.zshrc
|
@ -14,8 +14,8 @@ setopt HIST_IGNORE_SPACE
|
||||||
setopt HIST_REDUCE_BLANKS
|
setopt HIST_REDUCE_BLANKS
|
||||||
setopt HIST_VERIFY
|
setopt HIST_VERIFY
|
||||||
|
|
||||||
# Say how long a command took, if it took more than 15 seconds
|
# Say how long a command took, if it took more than 5 seconds
|
||||||
export REPORTTIME=15
|
export REPORTTIME=5
|
||||||
|
|
||||||
# Prompts for confirmation after 'rm *' etc
|
# Prompts for confirmation after 'rm *' etc
|
||||||
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
|
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
|
||||||
|
@ -30,19 +30,10 @@ setopt NOCLOBBER
|
||||||
# Don’t nice background processes
|
# Don’t nice background processes
|
||||||
setopt NO_BG_NICE
|
setopt NO_BG_NICE
|
||||||
|
|
||||||
# Makes Alt-s insert a sudo at beginning of prompt
|
|
||||||
function insert_sudo {
|
|
||||||
if [[ $BUFFER != "sudo "* ]]; then
|
|
||||||
BUFFER="sudo $BUFFER"; CURSOR+=6
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
zle -N insert-sudo insert_sudo
|
|
||||||
bindkey "^[s" insert-sudo
|
|
||||||
|
|
||||||
# Check for updates...
|
# Check for updates...
|
||||||
# Stolen and modified Oh-My-ZSH's update system
|
# Stolen and modified Oh-My-ZSH's update system
|
||||||
if [ "$DISABLE_DOTFILES_AUTO_UPDATE" != "true" ]; then
|
if [ "${ENABLE_DOTFILES_AUTO_UPDATE}" ]; then
|
||||||
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/internal_bin/check_for_upgrade.sh
|
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/check_for_upgrade.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Oh-My-ZSH Options below this line
|
# Oh-My-ZSH Options below this line
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DF_PATH=${HOME}/dotfiles/home/.config/i3
|
DF_PATH=${HOME}/dotfiles/.config/i3
|
||||||
CONFIG_PATH=${DF_PATH}/conf.d
|
CONFIG_PATH=${DF_PATH}/conf.d
|
||||||
DST_FILE=${DF_PATH}/config
|
DST_FILE=${DF_PATH}/config
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,14 @@ function _current_epoch() {
|
||||||
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
|
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
|
||||||
}
|
}
|
||||||
|
|
||||||
function _update_dotfiles_update() {
|
function _touch_dotfiles_update() {
|
||||||
echo "export LAST_EPOCH=$(_current_epoch)" > ${HOME}/.dotfiles-update
|
echo "export LAST_EPOCH=$(_current_epoch)" > ${HOME}/.dotfiles-update
|
||||||
echo "touched ~/.dotfiles-update"
|
echo "touched ~/.dotfiles-update"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _upgrade_dotfiles() {
|
function _upgrade_dotfiles() {
|
||||||
env _DOTFILES=$_DOTFILES sh $_DOTFILES/internal_bin/upgrade.sh
|
env _DOTFILES=$_DOTFILES sh $_DOTFILES/upgrade.sh
|
||||||
# update the zsh file
|
_touch_dotfiles_update
|
||||||
_update_dotfiles_update
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configure this in shell/env
|
# Configure this in shell/env
|
||||||
|
@ -49,12 +48,12 @@ if mkdir -p "$_DOTFILES/update.lock" 2>/dev/null; then
|
||||||
|
|
||||||
if [[ -z "$LAST_EPOCH" ]]; then
|
if [[ -z "$LAST_EPOCH" ]]; then
|
||||||
echo "Missing \$LAST_EPOCH"
|
echo "Missing \$LAST_EPOCH"
|
||||||
_update_dotfiles_update && return 0;
|
_touch_dotfiles_update && return 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
|
||||||
if [ $epoch_diff -gt $epoch_target ]; then
|
if [ $epoch_diff -gt $epoch_target ]; then
|
||||||
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
|
if [ "${DISABLE_UPDATE_PROMPT}" ]; then
|
||||||
_upgrade_dotfiles
|
_upgrade_dotfiles
|
||||||
else
|
else
|
||||||
echo "[Dotfiles] Would you like to check for updates? [Y/n]: \c"
|
echo "[Dotfiles] Would you like to check for updates? [Y/n]: \c"
|
||||||
|
@ -62,14 +61,14 @@ if mkdir -p "$_DOTFILES/update.lock" 2>/dev/null; then
|
||||||
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
|
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
|
||||||
_upgrade_dotfiles
|
_upgrade_dotfiles
|
||||||
else
|
else
|
||||||
_update_dotfiles_update
|
_touch_dotfiles_update
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Missing ~/.dotfiles-update"
|
echo "Missing ~/.dotfiles-update"
|
||||||
# create the zsh file
|
# create the zsh file
|
||||||
_update_dotfiles_update
|
_touch_dotfiles_update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rmdir $_DOTFILES/update.lock
|
rmdir $_DOTFILES/update.lock
|
137
install.sh
137
install.sh
|
@ -3,15 +3,24 @@
|
||||||
# This ensures that the entire script is downloaded before execution
|
# This ensures that the entire script is downloaded before execution
|
||||||
{
|
{
|
||||||
|
|
||||||
# Change this url to point to your repo if you made customizations
|
if ! which git >>/dev/null ; then
|
||||||
repourl="git://github.com/alopexc0de/dotfiles.git"
|
echo "Error: git is not installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Exit the script if any errors are encountered
|
# Exit the script if any errors are encountered
|
||||||
#set -e
|
#set -e
|
||||||
|
|
||||||
basedir=$HOME/dotfiles
|
# Change this url to point to your repo if you made customizations
|
||||||
bindir=$HOME/bin
|
GIT_REPO="git://github.com/alopexc0de/dotfiles.git"
|
||||||
postinst=$HOME/.dotfiles.postinst
|
|
||||||
|
DOTFILES=${HOME}/dotfiles
|
||||||
|
POSTINSTALL_SCRIPT=${HOME}/.dotfiles.postinst
|
||||||
|
|
||||||
|
if [ ! -e "${POSTINSTALL_SCRIPT}" ]; then
|
||||||
|
echo "No post install script found."
|
||||||
|
echo "Optionally create one at ${POSTINSTALL_SCRIPT} and rerun this script"
|
||||||
|
fi
|
||||||
|
|
||||||
# Attempts to safely install the configs as symlinks (backing up existing ones)
|
# Attempts to safely install the configs as symlinks (backing up existing ones)
|
||||||
function symlink() {
|
function symlink() {
|
||||||
|
@ -39,100 +48,82 @@ function symlink() {
|
||||||
|
|
||||||
read -p "Press enter to install my dotfiles " WAIT_FOR_INPUT
|
read -p "Press enter to install my dotfiles " WAIT_FOR_INPUT
|
||||||
|
|
||||||
read -p "[Dotfiles] Would you like to detect distro and auto-install dependencies? [Y/n]: " line
|
|
||||||
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
|
|
||||||
distrourl="https://raw.githubusercontent.com/alopexc0de/dotfiles/master/internal_bin"
|
|
||||||
if [ -f /etc/arch-release ]; then
|
|
||||||
bash <(curl -sL $distrourl/install.arch)
|
|
||||||
elif [ -f /etc/debian_version ]; then
|
|
||||||
bash <(curl -sL $distrourl/install.deb)
|
|
||||||
else
|
|
||||||
echo "This system does not have an auto-install file. Please install the dependencies manually"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! which git >>/dev/null ; then
|
|
||||||
echo "Error: git is not installed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the update script exists, try to do a normal update
|
# If the update script exists, try to do a normal update
|
||||||
if [ -x "$basedir/internal_bin/check_for_upgrade.sh" ]; then
|
if [ -x "${DOTFILES}/check_for_upgrade.sh" ]; then
|
||||||
source "$basedir/shell/env"
|
source "${DOTFILES}/.environment"
|
||||||
env _DOTFILES=$basedir DISABLE_UPDATE_PROMPT='FALSE' zsh -f $basedir/internal_bin/check_for_upgrade.sh
|
env DOTFILES=${DOTFILES} DISABLE_UPDATE_PROMPT=false zsh -f ${DOTFILES}/check_for_upgrade.sh
|
||||||
else
|
else
|
||||||
echo "Cloning dotfiles to $basedir"
|
echo "Cloning dotfiles to ${DOTFILES}"
|
||||||
rm -rf $basedir
|
rm -rf "${DOTFILES}"
|
||||||
git clone --depth=1 $repourl $basedir
|
git clone --recurse-submodules -j$(nproc) "${GIT_REPO}" "${DOTFILES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start installing config
|
|
||||||
|
|
||||||
echo "Linking config and local files"
|
|
||||||
# Environment
|
|
||||||
symlink $basedir/home/.local $HOME/.local
|
|
||||||
symlink $basedir/home/.config $HOME/.config
|
|
||||||
|
|
||||||
echo "Installing Oh-My-ZSH"
|
echo "Installing Oh-My-ZSH"
|
||||||
echo "When the install is done, type \"exit\" to continue installing dotfiles"
|
echo "When the install is done, type \"exit\" to continue installing dotfiles"
|
||||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||||
|
|
||||||
|
echo "Changing default shell to ZSH..."
|
||||||
|
chsh -s /usr/bin/zsh
|
||||||
|
|
||||||
echo "Building i3 configuration"
|
echo "Building i3 configuration"
|
||||||
$basedir/bin/build-i3-config
|
${DOTFILES}/bin/build-i3-config
|
||||||
|
|
||||||
echo "Linking X-Session files"
|
echo "Installing user binary directory to ~/bin"
|
||||||
# Stuff related to the X-Session
|
symlink ${DOTFILES}/bin ${HOME}/bin
|
||||||
symlink $basedir/home/.config/compton.conf $HOME/.compton.conf
|
|
||||||
symlink $basedir/home/Xresources $HOME/.Xresources
|
|
||||||
symlink $basedir/home/xinitrc $HOME/.xinitrc
|
|
||||||
|
|
||||||
echo "Linking shell files"
|
echo "Linking Configuration files..."
|
||||||
# Shell stuff
|
|
||||||
symlink $basedir/home/shell/tmux.conf $HOME/.tmux.conf
|
|
||||||
symlink $basedir/home/shell/bashrc $HOME/.bashrc
|
|
||||||
symlink $basedir/home/shell/zshrc $HOME/.zshrc
|
|
||||||
symlink $basedir/home/shell/vimrc $HOME/.vimrc
|
|
||||||
symlink $basedir/home/dmenurc $HOME/.dmenurc
|
|
||||||
symlink $basedir/home/dmrc $HOME/.dmrc
|
|
||||||
|
|
||||||
# Global git
|
# All the dotfiles that live in the home dir directly
|
||||||
symlink $basedir/home/gitconfig $HOME/.gitconfig
|
symlink ${DOTFILES}/.aliases ${HOME}/.aliases
|
||||||
|
symlink ${DOTFILES}/.bashrc ${HOME}/.bashrc
|
||||||
|
symlink ${DOTFILES}/.dmenurc ${HOME}/.dmenurc
|
||||||
|
symlink ${DOTFILES}/.dmrc ${HOME}/.dmrc
|
||||||
|
symlink ${DOTFILES}/.editorconfig ${HOME}/.editorconfig
|
||||||
|
symlink ${DOTFILES}/.environment ${HOME}/.environment
|
||||||
|
symlink ${DOTFILES}/.functions ${HOME}/.functions
|
||||||
|
symlink ${DOTFILES}/.gitconfig ${HOME}/.gitconfig
|
||||||
|
symlink ${DOTFILES}/.stalonetrayrc ${HOME}/.stalonetrayrc
|
||||||
|
symlink ${DOTFILES}/.tmux.conf ${HOME}/.tmux.conf
|
||||||
|
symlink ${DOTFILES}/.vimrc ${HOME}/.vimrc
|
||||||
|
symlink ${DOTFILES}/.zshrc ${HOME}/.zshrc
|
||||||
|
|
||||||
echo "Installing shell-history"
|
# Install ~/.config stuff
|
||||||
python3 -m pip install shellhistory
|
symlink ${DOTFILES}/.config/.rofi ${HOME}/.config/.rofi
|
||||||
|
symlink ${DOTFILES}/.config/compton ${HOME}/.config/compton
|
||||||
|
symlink ${DOTFILES}/.config/dunst ${HOME}/.config/dunst
|
||||||
|
symlink ${DOTFILES}/.config/gtk-2.0 ${HOME}/.config/gtk-2.0
|
||||||
|
symlink ${DOTFILES}/.config/gtk-3.0 ${HOME}/.config/gtk-3.0
|
||||||
|
symlink ${DOTFILES}/.config/htop ${HOME}/.config/htop
|
||||||
|
symlink ${DOTFILES}/.config/i3 ${HOME}/.config/i3
|
||||||
|
symlink ${DOTFILES}/.config/morc_menu ${HOME}/.config/morc_menu
|
||||||
|
symlink ${DOTFILES}/.config/nitrogen ${HOME}/.config/nitrogen
|
||||||
|
symlink ${DOTFILES}/.config/ranger ${HOME}/.config/ranger
|
||||||
|
symlink ${DOTFILES}/.config/terminator ${HOME}/.config/terminator
|
||||||
|
symlink ${DOTFILES}/.config/viewnior ${HOME}/.config/viewnior
|
||||||
|
symlink ${DOTFILES}/.config/volumeicon ${HOME}/.config/volumeicon
|
||||||
|
symlink ${DOTFILES}/.config/mimeapps.list ${HOME}/.config/mimeapps.list
|
||||||
|
|
||||||
echo "Installing VIM Pathogen..."
|
echo "Installing VIM Pathogen..."
|
||||||
mkdir -p $HOME/.vim/autoload $HOME/.vim/bundle
|
mkdir -p ${HOME}/.vim/{autoload,bundle}
|
||||||
curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
curl -LSs https://tpo.pe/pathogen.vim -o ${HOME}/.vim/autoload/pathogen.vim
|
||||||
|
|
||||||
echo "Installing VIM Sensible..."
|
echo "Installing VIM Sensible..."
|
||||||
cd $HOME/.vim/bundle
|
git clone git://github.com/tpope/vim-sensible.git ${HOME}/.vim/bundle/vim-sensible
|
||||||
git clone git://github.com/tpope/vim-sensible.git
|
|
||||||
|
|
||||||
echo "Installing VIM Iceberg theme"
|
echo "Installing VIM Iceberg theme"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
wget https://www.vim.org/scripts/download_script.php?src_id=25718 -O iceberg.zip
|
wget https://www.vim.org/scripts/download_script.php?src_id=25718 -O iceberg.zip
|
||||||
unzip iceberg.zip
|
unzip iceberg.zip
|
||||||
cp -r iceberg.vim/{autoload,colors} ~/.vim/
|
cp -r iceberg.vim/{autoload,colors} ${HOME}/.vim/
|
||||||
|
rm -rf /tmp/iceberg*
|
||||||
|
cd ${HOME}
|
||||||
|
|
||||||
echo "Adding user bin..."
|
if [ -e "$POSTINSTALL_SCRIPT" ]; then
|
||||||
mkdir -p $bindir
|
|
||||||
for file_path in $basedir/bin/*; do
|
|
||||||
symlink $file_path $bindir/$(basename $file_path)
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Changing default shell to ZSH..."
|
|
||||||
chsh -s /usr/bin/zsh
|
|
||||||
|
|
||||||
if [ -e "$postinst" ]; then
|
|
||||||
echo "Running post install..."
|
echo "Running post install..."
|
||||||
source "$postinst"
|
source "$POSTINSTALL_SCRIPT"
|
||||||
else
|
|
||||||
echo "No post install script found. Optionally create one at $postinst and reinstall your dotfies"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Install done."
|
echo "Install done."
|
||||||
echo "Check tmux, vim, and your shell to verify everything is correct"
|
echo "Log out and back in again for everything to take effect."
|
||||||
echo "you may need to launch a new instance of your shell"
|
|
||||||
|
|
||||||
} # Ensures that the whole script is downloaded before execution
|
} # Ensures that the whole script is downloaded before execution
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This ensures that the entire script is downloaded before execution
|
|
||||||
{
|
|
||||||
|
|
||||||
sudo pacman -Syu
|
|
||||||
sudo pacman -S yay
|
|
||||||
|
|
||||||
yay -Syu
|
|
||||||
|
|
||||||
yay -S tmux zsh vim git \
|
|
||||||
terminator rofi feh xcompmgr \
|
|
||||||
i3lock-fancy i3blocks ffcast
|
|
||||||
|
|
||||||
sudo pip install ntfy
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# This ensures that the entire script is downloaded before execution
|
|
||||||
{
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt upgrade
|
|
||||||
|
|
||||||
sudo apt install tmux zsh vim git\
|
|
||||||
terminator rofi feh xcompmgr\
|
|
||||||
i3lock-fancy i3blocks
|
|
||||||
|
|
||||||
sudo pip install ntfy
|
|
||||||
}
|
|
Loading…
Reference in New Issue