aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Williams <tgwil@tgwil.net>2024-10-12 19:23:45 -0400
committerTristan Williams <tgwil@tgwil.net>2024-10-12 19:23:45 -0400
commit62a07652483f498d89b8972c0edb7772a050ad62 (patch)
tree8ac92d69f5d48d1cfa19b12feaffbca80213ab7e
parent.bachrc: Set GPG_TTY for pinentry over SSH and in Emacs (diff)
downloaddotfiles.core-62a07652483f498d89b8972c0edb7772a050ad62.tar.gz
dotfiles.core-62a07652483f498d89b8972c0edb7772a050ad62.tar.bz2
dotfiles.core-62a07652483f498d89b8972c0edb7772a050ad62.zip
Create installer
The whole point of these dotfiles repos is to automate setup. Might as well have an installer.
-rw-r--r--README.md18
-rwxr-xr-xnew-user-setup.sh85
2 files changed, 90 insertions, 13 deletions
diff --git a/README.md b/README.md
index 7dc2dba..9c921df 100644
--- a/README.md
+++ b/README.md
@@ -8,19 +8,11 @@ My other dotfiles:
8- [dotfiles.sys](http://git.tgwil.net/dotfiles.sys/) for system configurations. 8- [dotfiles.sys](http://git.tgwil.net/dotfiles.sys/) for system configurations.
9 9
10## Installation 10## Installation
11### Clone this repository
12```bash
13cd
14git clone git@git.tgwil.net:dotfiles.core dotfiles.core
15```
16 11
17### Install the files 12The `new-user-setup.sh` script is all that is needed to setup a new user account. To run the script:
18```bash 13```bash
19cd 14cd ~/dotfiles.core
20 15./new-user-setup.sh
21# install .bash_profile
22ln -s $HOME/dotfiles.core/home/.bash_profile $HOME/.bash_profile
23
24# install .bashrc
25ln -s $HOME/dotfiles.core/home/.bashrc $HOME/.bashrc
26``` 16```
17
18If the script cannot be run for whatever reason, it is sufficiently documented to use it as a guide for manual installation.
diff --git a/new-user-setup.sh b/new-user-setup.sh
new file mode 100755
index 0000000..2c635ae
--- /dev/null
+++ b/new-user-setup.sh
@@ -0,0 +1,85 @@
1#!/usr/local/bin/bash
2#
3# FILE : dotfiles.core/new-account-setup.sh
4# TARGET: none
5# AUTHOR: tgwil
6#
7# This script sets up a new account. As this is the dotfiles.core
8# installer, only things which apply to every account are done here.
9#
10# This installer assumes that the dotfiles.core repository has been
11# cloned into the $HOME directory under the name 'dotfiles.core'. It
12# should be cloned and run this way for every new user.
13
14
15########################################################################
16## Setup
17########################################################################
18# Return to home
19cd
20
21# Set script output colors
22GREEN="\e[32m"
23YELLOW="\e[33m"
24WARN="\e[1;31m"
25ENDCOLOR="\e[0m"
26
27
28# Startup message
29echo ""
30echo "### Starting dotfiles.core installation... ###"
31
32
33########################################################################
34## Put files into place
35########################################################################
36# File placement function
37place_file () {
38 file=$1
39 target=$2
40 if [[ -e $target ]]; then
41 echo -e "\n${WARN}WARNING: ${target} already exists!${ENDCOLOR}"
42 invalid_selection=0
43 while
44 read -p "[A]bort, [D]elete, [R]eplace, [S]kip: " -n1 selection
45 echo ""
46 case $selection in
47 "a"|"A")
48 echo "Abort!"
49 exit 0;;
50 "d"|"D")
51 rm -fv $target
52 echo -e "${YELLOW}Removed ${target}${ENDCOLOR}"
53 ln -s $file $target
54 echo -e "${GREEN}Created: ${target} -> ${file}${ENDCOLOR}"
55 return 0;;
56 "r"|"R")
57 mv -f $target $target.bak & \
58 echo -e "${YELLOW}Moved: ${target} to ${target}.bak${ENDCOLOR}"
59 ln -s $file $target & \
60 echo -e "${GREEN}Created: ${target} -> ${file}${ENDCOLOR}"
61 return 0;;
62 "s"|"S")
63 echo -e "${YELLOW}Skipping ${target}${ENDCOLOR}"
64 return 0;;
65 *)
66 echo -e "${WARN}Invalid selection, try again...${ENDCOLOR}"
67 invalid_selection=1;;
68 esac
69 [[ $invalid_selection==1 ]]
70 do true; done
71 else
72 ln -s $file $target
73 echo -e "\n${GREEN}Created: ${target} -> ${file}${ENDCOLOR}"
74 fi
75}
76
77# Place files
78place_file $HOME/dotfiles.core/home/.bash_profile $HOME/.bash_profile
79place_file $HOME/dotfiles.core/home/.bashrc $HOME/.bashrc
80
81
82########################################################################
83## END OF SCRIPT
84########################################################################
85echo -e "\nInstallation completed: dotfiles.core\n"