Skip to content

Commit

Permalink
Created setup.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
derekhenderson818@gmail.com authored and derekhenderson818@gmail.com committed Oct 12, 2023
1 parent 6796909 commit ce89d46
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "Hello!"
15 changes: 15 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test
on: [push]

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Run setup.sh
run: pwd
1 change: 1 addition & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# dotfiles
# dotfiles

1. `$ cd ~`
2. `$ git clone https://github.com/D3r3k23/dotfiles`
3. `$ dotfiles/setup.sh`
4. `$ source .bashrc`
27 changes: 27 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Run from HOME directory

dotfiles=(.bashrc .vimrc)

autogen_begin="# AUTOGEN: begin (dotfiles/setup.sh)"
autogen_end="# AUTOGEN: end"

for dotfile in ${dotfiles[@]}; do
if ! [ -f $dotfile ]; then
add_dotfile=true
else
if [ $(grep -xc "$autogen_begin" $dotfile) -eq 0 ]; then
echo HERE
echo "" >> $dotfile
add_dotfile=true
else
add_dotfile=false
fi
fi
if [ "$add_dotfile" == true ]; then
echo $autogen_begin >> $dotfile
echo "if [ -f dotfiles/$dotfile ]; then" >> $dotfile
echo " source dotfiles/$dotfile" >> $dotfile
echo "fi" >> $dotfile
echo $autogen_end >> $dotfile
fi
done

0 comments on commit ce89d46

Please sign in to comment.