Compare commits

...

8 Commits

Author SHA1 Message Date
David Todd d396e06e4e remove clone depth 2021-01-11 22:32:06 -06:00
David Todd fa1ac68a70 update build-i3-config 2021-01-11 22:29:38 -06:00
David Todd 10de77b77e remove insert sudo shortcut 2021-01-11 22:27:28 -06:00
David Todd 635cb655be faster report time 2021-01-11 22:23:29 -06:00
David Todd cea6f93354 Move the update scripts to root of repo
Also rework the variables in the environment to use /bin/true and
/bin/false instead of string representations of this. Might cause
problems, haven't tested yet
2021-01-11 22:20:28 -06:00
David Todd fdb3222bcb rework installer 2021-01-11 22:13:00 -06:00
David Todd 56671a8b7f better ~/bin install 2021-01-11 21:41:00 -06:00
David Todd 351b67de1e Remove auto-install of dependencies 2021-01-11 21:37:24 -06:00
8 changed files with 83 additions and 132 deletions

View File

@ -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
export _DOTFILES="${HOME}/dotfiles"
# Allow automatic updates
export DISABLE_DOTFILES_AUTO_UPDATE="FALSE"
# Allow checking for automatic updates
export ENABLE_DOTFILES_AUTO_UPDATE=true
# 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)
export UPDATE_DOTFILES_DAYS=13
# 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
# Otherwise, the shell will not open the session again (eg. opening tabs, new terminals)
if $(tmux list-sessions >> /dev/null 2>&1); then
export TMUXATT="TRUE"
export TMUXATT=true
else
export TMUXATT="FALSE"
export TMUXATT=false
fi
# 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
fi

17
.zshrc
View File

@ -14,8 +14,8 @@ setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
# Say how long a command took, if it took more than 15 seconds
export REPORTTIME=15
# Say how long a command took, if it took more than 5 seconds
export REPORTTIME=5
# Prompts for confirmation after 'rm *' etc
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
@ -30,19 +30,10 @@ setopt NOCLOBBER
# Dont nice background processes
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...
# Stolen and modified Oh-My-ZSH's update system
if [ "$DISABLE_DOTFILES_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/internal_bin/check_for_upgrade.sh
if [ "${ENABLE_DOTFILES_AUTO_UPDATE}" ]; then
env ZSH=$ZSH _DOTFILES=$_DOTFILES DISABLE_UPDATE_PROMPT=$DISABLE_DOTFILES_UPDATE_PROMPT zsh -f $_DOTFILES/check_for_upgrade.sh
fi
# Oh-My-ZSH Options below this line

View File

@ -1,6 +1,6 @@
#!/bin/bash
DF_PATH=${HOME}/dotfiles/home/.config/i3
DF_PATH=${HOME}/dotfiles/.config/i3
CONFIG_PATH=${DF_PATH}/conf.d
DST_FILE=${DF_PATH}/config

View File

@ -10,15 +10,14 @@ function _current_epoch() {
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
}
function _update_dotfiles_update() {
function _touch_dotfiles_update() {
echo "export LAST_EPOCH=$(_current_epoch)" > ${HOME}/.dotfiles-update
echo "touched ~/.dotfiles-update"
}
function _upgrade_dotfiles() {
env _DOTFILES=$_DOTFILES sh $_DOTFILES/internal_bin/upgrade.sh
# update the zsh file
_update_dotfiles_update
env _DOTFILES=$_DOTFILES sh $_DOTFILES/upgrade.sh
_touch_dotfiles_update
}
# Configure this in shell/env
@ -49,12 +48,12 @@ if mkdir -p "$_DOTFILES/update.lock" 2>/dev/null; then
if [[ -z "$LAST_EPOCH" ]]; then
echo "Missing \$LAST_EPOCH"
_update_dotfiles_update && return 0;
_touch_dotfiles_update && return 0;
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
if [ $epoch_diff -gt $epoch_target ]; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
if [ "${DISABLE_UPDATE_PROMPT}" ]; then
_upgrade_dotfiles
else
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
_upgrade_dotfiles
else
_update_dotfiles_update
_touch_dotfiles_update
fi
fi
fi
else
echo "Missing ~/.dotfiles-update"
# create the zsh file
_update_dotfiles_update
_touch_dotfiles_update
fi
rmdir $_DOTFILES/update.lock

View File

@ -3,15 +3,24 @@
# This ensures that the entire script is downloaded before execution
{
# Change this url to point to your repo if you made customizations
repourl="git://github.com/alopexc0de/dotfiles.git"
if ! which git >>/dev/null ; then
echo "Error: git is not installed"
exit 1
fi
# Exit the script if any errors are encountered
#set -e
basedir=$HOME/dotfiles
bindir=$HOME/bin
postinst=$HOME/.dotfiles.postinst
# Change this url to point to your repo if you made customizations
GIT_REPO="git://github.com/alopexc0de/dotfiles.git"
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)
function symlink() {
@ -39,100 +48,82 @@ function symlink() {
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 [ -x "$basedir/internal_bin/check_for_upgrade.sh" ]; then
source "$basedir/shell/env"
env _DOTFILES=$basedir DISABLE_UPDATE_PROMPT='FALSE' zsh -f $basedir/internal_bin/check_for_upgrade.sh
if [ -x "${DOTFILES}/check_for_upgrade.sh" ]; then
source "${DOTFILES}/.environment"
env DOTFILES=${DOTFILES} DISABLE_UPDATE_PROMPT=false zsh -f ${DOTFILES}/check_for_upgrade.sh
else
echo "Cloning dotfiles to $basedir"
rm -rf $basedir
git clone --depth=1 $repourl $basedir
echo "Cloning dotfiles to ${DOTFILES}"
rm -rf "${DOTFILES}"
git clone --recurse-submodules -j$(nproc) "${GIT_REPO}" "${DOTFILES}"
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 "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)"
echo "Changing default shell to ZSH..."
chsh -s /usr/bin/zsh
echo "Building i3 configuration"
$basedir/bin/build-i3-config
${DOTFILES}/bin/build-i3-config
echo "Linking X-Session files"
# Stuff related to the X-Session
symlink $basedir/home/.config/compton.conf $HOME/.compton.conf
symlink $basedir/home/Xresources $HOME/.Xresources
symlink $basedir/home/xinitrc $HOME/.xinitrc
echo "Installing user binary directory to ~/bin"
symlink ${DOTFILES}/bin ${HOME}/bin
echo "Linking shell 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
echo "Linking Configuration files..."
# Global git
symlink $basedir/home/gitconfig $HOME/.gitconfig
# All the dotfiles that live in the home dir directly
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"
python3 -m pip install shellhistory
# Install ~/.config stuff
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..."
mkdir -p $HOME/.vim/autoload $HOME/.vim/bundle
curl -LSso $HOME/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
mkdir -p ${HOME}/.vim/{autoload,bundle}
curl -LSs https://tpo.pe/pathogen.vim -o ${HOME}/.vim/autoload/pathogen.vim
echo "Installing VIM Sensible..."
cd $HOME/.vim/bundle
git clone git://github.com/tpope/vim-sensible.git
git clone git://github.com/tpope/vim-sensible.git ${HOME}/.vim/bundle/vim-sensible
echo "Installing VIM Iceberg theme"
cd /tmp
wget https://www.vim.org/scripts/download_script.php?src_id=25718 -O 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..."
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
if [ -e "$POSTINSTALL_SCRIPT" ]; then
echo "Running post install..."
source "$postinst"
else
echo "No post install script found. Optionally create one at $postinst and reinstall your dotfies"
source "$POSTINSTALL_SCRIPT"
fi
echo "Install done."
echo "Check tmux, vim, and your shell to verify everything is correct"
echo "you may need to launch a new instance of your shell"
echo "Log out and back in again for everything to take effect."
} # Ensures that the whole script is downloaded before execution

View File

@ -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
}

View File

@ -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
}