mirror of
https://github.com/notwa/rc
synced 2025-02-05 07:43:22 -08:00
add ~/.prep
to do tasks like /etc/profile
This commit is contained in:
parent
665ebfc9f7
commit
cf51cc62b0
5 changed files with 60 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
|||
#!/usr/bin/env false
|
||||
# for ash, dash, bash, and zsh.
|
||||
|
||||
[ -n "$ZSH_VERSION" -o -n "$BASH_VERSION" ] && FANCY=1 || FANCY=0
|
||||
if [ "$FANCY" = 0 ]; then
|
||||
. ~/.prep # handle boring stuff like /etc/profile and $PATH
|
||||
fi
|
||||
|
||||
# {{{1 utilities
|
||||
|
||||
|
@ -66,7 +70,7 @@ fi
|
|||
|
||||
# enable colors {{{2
|
||||
|
||||
if [ "$FANCY" -eq 1 ]; then
|
||||
if [ "$FANCY" = 1 ]; then
|
||||
# busybox is smart enough to ignore --color flags when unsupported.
|
||||
alias grep='grep --color=auto'
|
||||
alias ls='ls --color=auto'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
[ -z "$PS1" ] && return
|
||||
. ~/.prep # handle boring stuff like /etc/profile and $PATH
|
||||
|
||||
HISTCONTROL=erasedups
|
||||
HISTSIZE=1000
|
||||
|
|
52
home/prep
Normal file
52
home/prep
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env false
|
||||
# for ash, dash, bash, and zsh.
|
||||
|
||||
if [ -r /etc/msystem ]; then
|
||||
# avoid sourcing /etc/profile because forking cygwin processes is awful.
|
||||
. /etc/msystem # this doesn't fork anything, thankfully.
|
||||
|
||||
# NOTE: never inherits parent process's PATH. does not add perl paths.
|
||||
PATH="/usr/local/bin:/usr/bin:/bin"
|
||||
PATH="$PATH:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem"
|
||||
PATH="$PATH:/c/Windows/System32/WindowsPowerShell/v1.0/"
|
||||
MANPATH="/usr/local/man:/usr/share/man:/usr/man:/share/man"
|
||||
INFOPATH="/usr/local/info:/usr/share/info:/usr/info:/share/info"
|
||||
SYSCONFDIR="${SYSCONFDIR:-/etc}" # not exported for some reason?
|
||||
|
||||
CONFIG_SITE="/etc/config.site"
|
||||
SHELL="/usr/bin/zsh"
|
||||
|
||||
if [ "$MSYSTEM" = MSYS ]; then
|
||||
PATH="$PATH:/opt/bin"
|
||||
PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig"
|
||||
else
|
||||
PATH="$MINGW_PREFIX/bin:$PATH"
|
||||
PKG_CONFIG_PATH="$MINGW_PREFIX/lib/pkgconfig:$MINGW_PREFIX/share/pkgconfig"
|
||||
export ACLOCAL_PATH="$MINGW_PREFIX/share/aclocal:/usr/share/aclocal"
|
||||
MANPATH="$MINGW_PREFIX/local/man:$MINGW_PREFIX/share/man:$MANPATH"
|
||||
fi
|
||||
|
||||
[ -n "${USER:=$USERNAME}" ] || USER="$(exec id -un)" # not much choice here
|
||||
[ -n "${HOSTNAME:=$HOST}" ] || HOSTNAME="$(exec /usr/bin/hostname)"
|
||||
|
||||
LANG="en_US.UTF-8"
|
||||
[ -s /etc/localtime ] && TZ=":/etc/localtime" || TZ="America/Vancouver"
|
||||
|
||||
TMP="/tmp"; TEMP="/tmp"
|
||||
tmp="C:\\Users\\$USER\\AppData\\Local\\Temp"; temp="$tmp"
|
||||
ORIGINAL_TMP="/c/Users/$USER/AppData/Local/Temp"; ORIGINAL_TEMP="$ORIGINAL_TMP"
|
||||
export CONFIG_SITE HOSTNAME INFOPATH LANG MANPATH ORIGINAL_TEMP ORIGINAL_TMP PATH PKG_CONFIG_PATH SHELL TEMP TMP TZ USER temp tmp
|
||||
|
||||
elif [ -r /etc/profile ]; then
|
||||
if [ -n "$ZSH_VERSION" ]; then
|
||||
emulate sh -c "source /etc/profile"
|
||||
else
|
||||
. /etc/profile
|
||||
fi
|
||||
|
||||
else # something's strange; set some sane defaults (from alpine)
|
||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
export CHARSET="UTF-8"
|
||||
export LANG="C.UTF-8"
|
||||
export LC_COLLATE="C"
|
||||
fi
|
|
@ -1,4 +1,4 @@
|
|||
[ -e /etc/profile ] && emulate sh -c "source /etc/profile"
|
||||
. ~/.prep # handle boring stuff like /etc/profile and $PATH
|
||||
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=99999
|
||||
|
|
2
install
2
install
|
@ -130,7 +130,7 @@ cd "${HOME:?HOME variable empty or unset}" || die "failed to change directory"
|
|||
backup_dir="$rc/backup-$(date -u '+%s')"
|
||||
[ ! -d "$backup_dir" ] || die "backup directory already exists"
|
||||
|
||||
for f in .bashrc .zshrc .-shrc .prezto-compinit .ls_colors \
|
||||
for f in .bashrc .zshrc .prep .-shrc .prezto-compinit .ls_colors \
|
||||
.vimrc .inputrc .Xresources .screenrc .tmux.conf; do
|
||||
hardlink "$f" "$rc/home/${f#.}"
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue