aboutsummaryrefslogtreecommitdiff
path: root/shell/misc
blob: c589f10e194d5bdc00d4e462e3ecb5d26f2453e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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"
}