Clean up scripts

This commit is contained in:
2019-12-31 00:38:46 -05:00
parent 00aca34e56
commit 362e838895
20 changed files with 280 additions and 67 deletions

View File

@@ -22,10 +22,14 @@ export TEMP=/tmp
export TMPDIR=/tmp
# Customize the shell prompt
in_git_work_tree() {
git rev-parse --is-inside-work-tree &> /dev/null
}
parse_git_branch() {
if [[ "$PWD" != "$HOME" ]]; then
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
fi
if in_git_work_tree; then
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
fi
}
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[33m\]\n$(parse_git_branch)\[\033[0;32m\]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '

View File

@@ -45,13 +45,15 @@ Data="0x00000000”
and verify that `which envsubst` reports back `/usr/bin/envsubst`.
* Bug report is at https://github.com/Alexpux/MSYS2-packages/issues/735
* Map caps to left-ctrl using https://sharpkeys.codeplex.com/
* Setup git completions for bash:
* `curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash`
* Use symlink command `cmd //c 'mklink .name-of-dotfile drive:\path\to\file'`.
* Symlink `~/.private-files` to the root directory containing `dev/`.
* Symlink `~/.dev` to `~/.private-files/path/to/dev`.
* Symlink `~/.dotfiles` to `~/.dev/path/to/dotfiles`.
* Create `~/bin`.
* Symlink `$HOME/bin/sym` to `$HOME/.dotfiles/windows/symbolic-link.sh`. You can now use this to
* Symlink `$HOME/bin/sym` to `$HOME/.dotfiles/bin/symbolic-link`. You can now use this to
do symlinks.
* Symlink files in the dotfiles windows folder.
* Symlink appropriate files in the root dotfiles directory.
@@ -74,10 +76,10 @@ Data="0x00000000”
## Setting up Visual Studio
* Use the backed up VS2015 ISO.
* Use the backed up VS2015 ISO or download it from https://go.microsoft.com/fwlink/?LinkId=615448&clcid=0x409
* Pick a custom install directory, e.g. `/x/programs/Visual Studio 15`
* Make sure to not do a default install. You must select the C++ language support.
* Edit visual studio options. Open Debugging -> Symbols and add the path to your cached symbols.
* Select a custom install and check off the C++ language support.
* Once installed, open Visual Studio and go to `Tools` -> `Options`. Open `Debugging` -> `Symbols` and add the path to the cached symbols directory that you set up above under `Setup a symbol server`.
## Setting up Vim
@@ -147,7 +149,10 @@ Data="0x00000000”
## Software
* Install `tree`: `pacman -S tree`
* Install Desktop Restore (http://www.midiox.com/index.htm?http://midiox.com/desktoprestore.htm)
* Install Android platform tools to get adb.exe:
* Download Android commandline tools https://developer.android.com/studio/#downloads
* Unzip to some location.

View File

@@ -1,80 +0,0 @@
#!/bin/bash
# @improve this path stuff
source_helpers="$HOME/.dotfiles/script_helpers"
source "$source_helpers/printing.sh"
source "$source_helpers/file_ops.sh"
abort() {
error "\nAborting...\n"
exit 1
}
# If the path is not symbolic or an absolute drive path then we return it in an expanded form.
clean_path() {
path=$1
if [[ $(is_absolute_unix_path $path) -eq 0 && $(is_sym_file $path) -eq 0 ]]; then
path=$(expand_path "$path")
fi
echo $path
}
path_debug() {
path=$1
printf "\ninfo on path '$path'\n"
printf "abs unix path: $(is_absolute_unix_path $path)\n"
printf "sym file: $(is_sym_file $path)\n"
if [[ $path =~ \/+ ]]; then echo "unix path\n"; else echo "not unix path\n"; fi
expanded_path=$(expand_path "$path")
printf "expanded version: $expanded_path\n"
if [[ $(is_absolute_unix_path $path) -eq 0 && $(is_sym_file $path) -eq 0 ]]; then
printf "needs cleaning\n"
else
printf "no cleaning needed\n"
fi
}
cwd=$PWD
platform=`uname` # 'Linux', 'Darwin', etc
source_path=""
dest_path=""
#echo "got $1 and $2"
#path_debug $1
#path_debug $2
if [[ $1 ]]; then
source_path="$1"
else
printf "${BOLD}${YELLOW}Enter full path to source file/dir:\n${NORMAL}"
read -e source_path
fi
source_path=$(clean_path "$source_path")
! test -d "$source_path" && ! test -e "$source_path" && error "Source path '$source_path' doesn't exist!" && abort
if [[ $2 ]]; then
dest_path="$2"
else
printf "${BOLD}${YELLOW}Enter full path to symlink destination:\n${NORMAL}"
read -e dest_path
fi
dest_path=$(clean_path $dest_path)
test -d "$dest_path" && error "Dest folder '$dest_path' already exists!" && abort
test -e "$dest_path" && error "Dest file '$dest_path' already exists!" && abort
source_path=$(windows_path $source_path)
dest_path=$(windows_path $dest_path)
cmd="cmd //c 'mklink $dest_path $source_path'"
echo "${BOLD}${BLUE}Will attempt to link ${GREEN}$source_path${BLUE} to ${GREEN}$dest_path${BLUE}"
printf "\n${BOLD}Enter 1 to proceed\n${YELLOW}> ${NORMAL}"
read confirm
if [[ $confirm == 1 ]]; then
eval "$cmd"
else
abort
fi