1
Fork 0

move several configurations into central interactive script

This commit is contained in:
Alan Faubert 2018-10-21 22:58:53 -04:00
parent dfee455a0c
commit a6ab8bb10a
15 changed files with 74 additions and 73 deletions

View File

@ -1,3 +1,26 @@
# config
My config files for various things.
Run `config.sh` to automate the setup of several of them.
## Docker on WSL
Install [Docker for Windows](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe). More details are available [here](https://docs.docker.com/docker-for-windows/install/).
Install Docker in WSL, using the [Ubuntu instructions](https://docs.docker.com/install/linux/docker-ce/ubuntu/) (or another distro if applicable).
Use the configuration script to setup `docker-relay` and to add your user to the `docker` group.
Run `sudo docker-relay` to start the relay.
## Git Aliases
- `git clean-branches` - delete local branches that track remote branches that have been deleted
- `git clean-dates` - set all committer dates of all commits in the given range to their author dates
- `git clean-original` - delete all `refs/original/` refs left by `git filter-branch`
- `git clean-permissions` - reset all file permissions to to those according to the repository
- `get clean-user` - set all author/committer emails/names of all commits in the given range to the currently configured `user.email` and `user.name`
- `git turbo-gc` - turbo garbage collect, wipe reflog, everything
- `git unfilemode` - unset `core.filemode` on this repo, so global (`core.filemode = false`) will be used
- `git user-*` - set `user.email` and `user.name` as appropriate

View File

@ -1 +0,0 @@
# Bash Completion Config

View File

@ -1,5 +0,0 @@
#!/bin/bash
cd
mkdir -p .bash_completion.d
[ -f .bash_completion ] && grep -Fq .bash_completion.d .bash_completion || echo $'for i in ~/.bash_completion.d/*; do\n\t[ -f "$i" ] && . "$i"\ndone' >> .bash_completion

51
config.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
ROOT="$(dirname "$(readlink -e "$0")")"
while :; do
SELECTION="$(whiptail --menu '' 15 40 5 \
autocomplete 'Setup .bash_completion.d' \
nodejs 'Install Node.js' \
docker 'Setup Docker WSL/Windows relay' \
gitconfig 'Create .gitconfig symlink' \
tmux 'Create .tmux.conf symlink' \
--title 'Select action' --notags --default-item "$SELECTION" 3>&2 2>&1 1>&3-)"
case "$SELECTION" in
autocomplete)
cd && \
mkdir -p .bash_completion.d && \
([ -f .bash_completion ] && grep -Fq .bash_completion.d .bash_completion || echo $'for i in ~/.bash_completion.d/*; do\n\t[ -f "$i" ] && . "$i"\ndone' >> .bash_completion) && \
whiptail --msgbox Done 7 10
;;
nodejs)
NODE_VERSION="$(whiptail --inputbox 'Version?' 10 20 3>&2 2>&1 1>&3-)" && \
[ "$NODE_VERSION" ] && \
cd && \
rm -rf nodejs && \
mkdir nodejs && \
cd nodejs && \
wget https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz -O- | tar xJ --strip-components=1 && \
(which node || echo 'PATH="$HOME/nodejs/bin:$PATH"' >> ~/.profile) && \
whiptail --msgbox Done 7 10
;;
docker)
sudo apt-get install socat && \
cd /usr/local/bin && \
sudo ln -fs "$ROOT"/npiperelay.exe && \
sudo ln -fs "$ROOT"/docker-relay && \
sudo adduser $USER docker && \
whiptail --msgbox Done 7 10
;;
gitconfig)
cd && \
ln -fs "$ROOT"/.gitconfig && \
whiptail --msgbox Done 7 10
;;
tmux)
cd && \
ln -fs "$ROOT"/.tmux.conf && \
whiptail --msgbox Done 7 10
;;
*)
exit
;;
esac
done

View File

@ -1,13 +0,0 @@
# Docker on WSL Config
Install [Docker for Windows](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe). More details are available [here](https://docs.docker.com/docker-for-windows/install/).
Install Docker in WSL, using the [Ubuntu instructions](https://docs.docker.com/install/linux/docker-ce/ubuntu/) (or another distro if applicable).
Install `socat` in WSL.
In `/usr/local/bin/` (or anywhere else in root's PATH), symlink to [`npiperelay.exe`](npiperelay.exe) (compiled from [here](https://github.com/jstarks/npiperelay)) and [`docker-relay`](docker-relay).
Run `sudo docker-relay` to start the relay.
To enable calling `docker` without `sudo`, add the user to the `docker` group: `sudo adduser ${USER} docker`.

View File

@ -1,8 +0,0 @@
#!/bin/bash
DIR="$(dirname "$(readlink -e "$0")")"
sudo apt-get install socat
cd /usr/local/bin
sudo ln -fs "$DIR"/npiperelay.exe
sudo ln -fs "$DIR"/docker-relay
sudo adduser $USER docker

View File

@ -1,12 +0,0 @@
# Git Config
## Aliases
- `git clean-branches` - delete local branches that track remote branches that have been deleted
- `git clean-dates` - set all committer dates of all commits in the given range to their author dates
- `git clean-original` - delete all `refs/original/` refs left by `git filter-branch`
- `git clean-permissions` - reset all file permissions to to those according to the repository
- `get clean-user` - set all author/committer emails/names of all commits in the given range to the currently configured `user.email` and `user.name`
- `git turbo-gc` - turbo garbage collect, wipe reflog, everything
- `git unfilemode` - unset `core.filemode` on this repo, so global (`core.filemode = false`) will be used
- `git user-*` - set `user.email` and `user.name` as appropriate

View File

@ -1,5 +0,0 @@
#!/bin/bash
DIR="$(dirname "$(readlink -e "$0")")"
cd
ln -fs "$DIR"/.gitconfig

View File

@ -1,3 +0,0 @@
# Node.js Config
- `config.js` - Install given version of Linux 64-bit Node.js to ~/nodejs.

View File

@ -1,10 +0,0 @@
#!/bin/bash
if [ -z "$1" ]; then echo $'Install Node.js to ~/nodejs\nArguments: <node version>'; exit 1; fi
cd
rm -rf nodejs
mkdir nodejs
cd nodejs
wget https://nodejs.org/dist/v$1/node-v$1-linux-x64.tar.xz -O- | tar xJ --strip-components=1
which node || echo 'PATH="$HOME/nodejs/bin:$PATH"' >> ~/.profile

View File

@ -1,11 +0,0 @@
# tmux Config
The included `.tmux.conf` makes the following changes/additions to the default tmux key bindings:
- The prefix key is now `ctrl-a` (and `ctrl-a ctrl-a` is used to send `ctrl-a` to the console)
- Switching windows is done with `ctrl-alt-left/right` (no prefix key)
- Switching panes is done with `alt-left/right/up/down` (no prefix key)
- Splitting panes is done with `ctrl-a |` (horizontal) and `ctrl-a -` (vertical)
- Reloading `~/.tmux.conf` is done with `ctrl-a shift-r`
Mouse control is also enabled, and the terminal mode is set to `screen-256color`.

View File

@ -1,5 +0,0 @@
#!/bin/bash
DIR="$(dirname "$(readlink -e "$0")")"
cd
ln -fs "$DIR"/.tmux.conf