Compare commits
3 Commits
8cfb57f4be
...
40dcc1b24d
| Author | SHA1 | Date | |
|---|---|---|---|
| 40dcc1b24d | |||
| 9c041754b7 | |||
| f414fef84b |
@ -1,2 +1,3 @@
|
|||||||
^/\.git.*
|
^/\.git.*
|
||||||
.*\.bak$
|
.*\.bak$
|
||||||
|
readme.md
|
||||||
|
|||||||
79
readme.md
Normal file
79
readme.md
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# Stew Home
|
||||||
|
|
||||||
|
This repo contains dotfiles LailaTheElf uses in the home directory. It also
|
||||||
|
contains a script (`stow/dot-local/bin/stowhome`) that uses GNU Stow to link
|
||||||
|
them from all the correct spots.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
> NOTE: this is made for [ElfOS](https://gitea.finnvanreenen.nl/LailaTheElf/ElfOS.git)
|
||||||
|
> any other setup are **not** suported!
|
||||||
|
|
||||||
|
1. Install GNU Stow:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo pacman -Sy stow
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Clone this repository to `~/.config/dotfiles`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://gitea.finnvanreenen.nl/LailaTheElf/stowhome.git -O "$HOME/.config/dotfiles"
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install stowhome
|
||||||
|
|
||||||
|
```sh
|
||||||
|
"$HOME/.config/dotfiles/stow/dot-local/bin/stowhome" stow
|
||||||
|
```
|
||||||
|
|
||||||
|
## File structure
|
||||||
|
|
||||||
|
Of the repo, the root directory contains a folder for every package and the
|
||||||
|
following files:
|
||||||
|
|
||||||
|
- **.stow-local-ignore**: The ignore file for GNU Stow (uses [Perl regex](https://perldoc.perl.org/perlre)).
|
||||||
|
- **readme.md**: This file.
|
||||||
|
|
||||||
|
The packages is essentially a chroot of the home directory. All the files in
|
||||||
|
there are links to the corresponding place of the home directory (except the
|
||||||
|
once matching a line in the `.stow-local-ignore` file).
|
||||||
|
|
||||||
|
The `--dotfile` option is used; this means files and directories starting with
|
||||||
|
'dot-' will be prepended with a dot. So `dot-local` will become `.local`. This
|
||||||
|
is to prevent a repository full of hidden files.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Link the dotfiles (stewing)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
stowhome <package> [<package> [<package> [...]]]
|
||||||
|
```
|
||||||
|
|
||||||
|
Where `<package>` is a directory from this repo or `all` foor all packages.
|
||||||
|
|
||||||
|
If the dotfiles already exist as normal files (not symlinks), it will skip this
|
||||||
|
file. To overwrite the file in stow, use this command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
stowhome --adopt <package> [<package> [<package> [...]]]
|
||||||
|
```
|
||||||
|
|
||||||
|
To overwrite the dotfile, you can just remove or rename the file and then run
|
||||||
|
`stowhome` again.
|
||||||
|
|
||||||
|
### Unlink the dotfiles (destewing)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
stowhome -D <package> [<package> [<package> [...]]]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update dotfiles
|
||||||
|
|
||||||
|
To edit an already managed by stowhome dotfile, you can just edit it. The
|
||||||
|
changes will update in the Git repository (`$HOME/.config/dotfiles`), but no
|
||||||
|
commit will be made.
|
||||||
|
|
||||||
|
Overriding a file with one in this repo is easies by removing or renaming the
|
||||||
|
file.
|
||||||
@ -9,9 +9,36 @@ alias ls='ls --color=auto'
|
|||||||
alias la='ls --color=auto -plhA'
|
alias la='ls --color=auto -plhA'
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
|
|
||||||
PS1='\n\h \W\n\$ '
|
parse_git_branch() {
|
||||||
|
local b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||||
|
if [ "$b" != "" ]
|
||||||
|
then
|
||||||
|
git diff --cached --exit-code &> /dev/null || b="${b}+"
|
||||||
|
git diff --exit-code &> /dev/null || b="${b}*"
|
||||||
|
fi
|
||||||
|
echo -n "$b"
|
||||||
|
}
|
||||||
|
# \e[0;$(e=$?;((e))&& echo "91" || echo "0"))m\]\$\[\e[0m\]
|
||||||
|
PS1='\n\[\e[35m\]\h \[\e[32m\]\w \[\e[35m\]$(parse_git_branch)\[\e[0m\]\n$ '
|
||||||
|
|
||||||
export PATH="$PATH:$HOME/.local/bin"
|
export PATH="$PATH:$HOME/.local/bin"
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
|
export QSYS_ROOTDIR="$HOME/.local/intelFPGA_lite/18.1/quartus/sopc_builder/bin"
|
||||||
. "$HOME/.cargo/env"
|
. "$HOME/.cargo/env"
|
||||||
|
|
||||||
|
# start ssh-agent
|
||||||
|
if [[ ! -f "$HOME/.ssh/agent.env" ]]
|
||||||
|
then
|
||||||
|
ssh-agent >"$HOME/.ssh/agent.env"
|
||||||
|
else
|
||||||
|
. "$HOME/.ssh/agent.env" >/dev/null
|
||||||
|
ps -p $SSH_AGENT_PID >/dev/null || ssh-agent >"$HOME/.ssh/agent.env"
|
||||||
|
fi
|
||||||
|
. "$HOME/.ssh/agent.env"
|
||||||
|
export SSH_AGENT_PID;
|
||||||
|
export SSH_AUTH_SOCK;
|
||||||
|
|
||||||
|
# rust
|
||||||
|
export RUSTUP_HOME="$HOME/.local/rust/rustup"
|
||||||
|
export CARGO_HOME="$HOME/.local/rust/cargo"
|
||||||
|
. $HOME/.local/rust/cargo
|
||||||
|
|||||||
@ -1,8 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function get_all_packages() {
|
||||||
|
cd "$HOME/.config/dotfiles"
|
||||||
|
find . -maxdepth 1 -type d -not -name ".git" -not -name "."
|
||||||
|
}
|
||||||
|
|
||||||
|
stow_cmd="stow --dir '$HOME/.config/dotfiles' --target '$HOME' --dotfiles"
|
||||||
|
|
||||||
if [ "$*" == "" ]
|
if [ "$*" == "" ]
|
||||||
do
|
then
|
||||||
echo "you must supply at least one package"
|
echo "you must supply at least one package"
|
||||||
|
echo
|
||||||
|
echo "available packages:"
|
||||||
|
get_all_packages | sed -e 's|^.\/| - |'
|
||||||
else
|
else
|
||||||
stow --dir "$HOME/.config/dotfiles" --target "$HOME" --dotfiles $*
|
if [ "$(echo "$*" | grep -E -e '^(.* )?all$')" != "" ]
|
||||||
|
then
|
||||||
|
all_packages=$(get_all_packages | sed -e 's|^.\/||' | tr '\n' ' ')
|
||||||
|
$stow_cmd $(echo "$*" | sed -e "s/all/$all_packages/")
|
||||||
|
else
|
||||||
|
$stow_cmd $*
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user