aboutsummaryrefslogtreecommitdiff
path: root/shell/misc
diff options
context:
space:
mode:
authorMitch Riedstra <mitch@riedstra.us>2019-09-12 23:10:58 -0400
committerMitch Riedstra <mitch@riedstra.us>2019-09-12 23:10:58 -0400
commit75ed7b4f86cd883f32b88d5613ff46d8a21f6794 (patch)
treed38260dd255458b2a02193d4e0e2e0f6fe9f6027 /shell/misc
parent879d857e0eafa1f716d9e156862154baf49d7655 (diff)
downloaddotfiles-75ed7b4f86cd883f32b88d5613ff46d8a21f6794.tar.gz
dotfiles-75ed7b4f86cd883f32b88d5613ff46d8a21f6794.tar.xz
Split my shell configuration into multiple files and a build script to generate for multiple shells
Diffstat (limited to 'shell/misc')
-rw-r--r--shell/misc34
1 files changed, 34 insertions, 0 deletions
diff --git a/shell/misc b/shell/misc
new file mode 100644
index 0000000..c589f10
--- /dev/null
+++ b/shell/misc
@@ -0,0 +1,34 @@
+
+set_go() {
+ export GOPATH="${GOPATH:-$HOME/go}"
+ export PATH="$GOPATH/bin:$PATH"
+
+ _gobin="/usr/local/go/bin"
+ if [ -e "$_gobin" ] ; then
+ export PATH="$_gobin:$PATH"
+ fi
+}
+pkg_switch_branch() {
+ _f="/etc/pkg/FreeBSD.conf"
+ cp $_f ${_f}.orig
+ sed -e's/quarterly/latest/' < ${_f}.orig > ${_f}
+}
+# System setup `chroot`, useful mainly on Linux
+syschroot() {
+ CHDIR=$1
+ PROG=$2
+ CUR_PS1="$PS1"
+ PS1="(CHROOT) # "
+ mount -t proc none "$CHDIR/proc"
+ mount -o bind /dev "$CHDIR/dev"
+ mount -o bind /dev/pts "$CHDIR/dev/pts"
+ mount -o bind /sys "$CHDIR/sys"
+ mount -o bind /run "$CHDIR/run"
+ if [ "$PROG" = "/bin/bash" ] ; then
+ PS1="(CHROOT) [ \u@\h \w ] # "
+ fi
+ chroot "$CHDIR" "$PROG"
+ umount "$CHDIR/dev/pts" "$CHDIR/dev" "$CHDIR/sys" "$CHDIR/proc" \
+ "$CHDIR/run"
+ PS1="$CUR_PS1"
+}