Modifications, again

This commit is contained in:
Geoffrey Frogeye 2017-02-12 15:14:51 +01:00
parent cb8ca9c904
commit 0952eab0de
5 changed files with 56 additions and 37 deletions

25
bashrc
View file

@ -50,7 +50,6 @@ alias s='sudo -s -E'
alias po='proxy off'
alias nw="sudo systemctl restart NetworkManager"
alias mc="machines"
# Superseding commands with better ones if they are present
if which vim &> /dev/null; then
alias vi='vim'
@ -88,28 +87,28 @@ elif [[ $USER == 'geoffrey' || $USER == 'gbontoux' || $USER == 'gpreud' ]]; then
else
col=33;
fi
PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
PS2="> "
PS3="+ "
PS4="- "
export PS1="\[\e]2;\u@\h \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
export PS2="> "
export PS3="+ "
export PS4="- "
# CUSTOM SCRIPTS
export PATH="$HOME/.scripts/:$PATH"
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
# UTILITIES
# Bash completion
[ -f /etc/bash_completion ] && . /etc/bash_completion
# Command not found handlers
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash # Arch
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh # Arch (alternative, for Manjaro mostly)
# Bad day mood-saver
if which thefuck &> /dev/null; then
alias fuck='TF_CMD=$(TF_ALIAS=fuck PYTHONIOENCODING=utf-8 TF_SHELL_ALIASES=$(alias) thefuck $(fc -ln -1)) && eval $TF_CMD && history -s $TF_CMD'
alias FUCK='fuck'
fi
# CUSTOM SCRIPTS
export PATH="$HOME/.scripts/:$PATH"
[ -f ~/.gscripts/gprofile ] && source ~/.gscripts/gprofile
# Command not found handlers
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash # Arch
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh # Arch (alternative, for Manjaro mostly)

View file

@ -3,11 +3,10 @@
#
# SSH agent
[ -z "$SSH_AUTH_SOCK" ] && eval `ssh-agent -s` &> /dev/null
[[ -z "$SSH_AUTH_SOCK" && -x "$(which ssh-agent)" ]] && eval `ssh-agent -s` &> /dev/null
# TTY Colors
[ -f "$HOME/.config/linuxColors.sh" ] && . "$HOME/.config/linuxColors.sh"
# Bashrc
#[ -f ~/.bashrc ] && . ~/.bashrc
# TODO Is this really useful?
[ -f ~/.bashrc ] && . ~/.bashrc

View file

@ -3,10 +3,20 @@
# Installs Debian packages on a Debian system
# with no root access, in the user home
if [[ ! $(which apt &> /dev/null) ]]; then
echo "This is not a Debian system (or apt is not installed)."
# CONFIGURATION
# Verifications
if [[ -z $DEBIAN_MIRROR && ! -f /etc/apt/sources.list ]]; then
echo "Unable to find a mirror. Try setting DEBIAN_MIRROR (see help)."
exit 1
fi
if [[ -z $DEBIAN_DB && ! $(which apt &> /dev/null) ]]; then
echo "Unable to find a database for packages to install. Try setting DEBIAN_DB (see help)."
exit 1
fi
# Overrides
[ -z $DEBLOC_PREFIX ] && DEBLOC_PREFIX=$(dpkg --print-architecture)
[ -z $DEBLOC_DB ] && DEBLOC_DB=${XDG_CONFIG_HOME:-$HOME/.config}/$DEBLOC_PREFIX
@ -18,9 +28,13 @@ if [ -z $DEBIAN_MIRROR ]; then
DEBIAN_MIRROR="$(echo -e "$DEBIAN_MIRROR" | cut -d ' ' -f 2 | sed 's/\/$//' | sort | uniq)"
fi
# Preparation
mkdir -p $DEBLOC_DB &> /dev/null
mkdir -p $DEBLOC_ROOT &> /dev/null
# PRIVATE FUNCTIONS
# Tell if a package exists
function _debloc-exists { # package
if [[ -n $DEBIAN_DB && -f $DEBIAN_DB ]]; then
@ -229,15 +243,16 @@ function _debloc-installDeps { # package
return 0
}
# USER FUNCTIONS
# PUBLIC FUNCTIONS
function debloc_env {
export PATH="$DEBLOC_ROOT/usr/bin:$DEBLOC_ROOT/usr/games/:$DEBLOC_ROOT/usr/lib/git-core:$PATH"
export LIBRARY_PATH="$DEBLOC_LD:$LIBRARY_PATH"
export C_INCLUDE_PATH="$DEBLOC_ROOT/usr/include:$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="$DEBLOC_ROOT/usr/include:$DEBLOC_ROOT/usr/include/python2.7/:$DEBLOC_ROOT/usr/include/x86_64-linux-gnu/python2.7/:$CPLUS_INCLUDE_PATH"
export LD_LIBRARY_PATH="$DEBLOC_LD:$LD_LIBRARY_PATH"
export PYTHONPATH="$DEBLOC_ROOT/usr/lib/python3/dist-packages:$PYTHONPATH"
export QT_QPA_PLATFORM_PLUGIN_PATH="$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms"
echo "export PATH=\"$DEBLOC_ROOT/usr/bin:$DEBLOC_ROOT/usr/games/:$DEBLOC_ROOT/usr/lib/git-core:\$PATH\""
echo "export LIBRARY_PATH=\"$DEBLOC_LD:\$LIBRARY_PATH\""
echo "export C_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:\$C_INCLUDE_PATH\""
echo "export CPLUS_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:$DEBLOC_ROOT/usr/include/python2.7/:$DEBLOC_ROOT/usr/include/x86_64-linux-gnu/python2.7/:\$CPLUS_INCLUDE_PATH\""
echo "export LD_LIBRARY_PATH=\"$DEBLOC_LD:\$LD_LIBRARY_PATH\""
echo "export PYTHONPATH=\"$DEBLOC_ROOT/usr/lib/python3/dist-packages:\$PYTHONPATH\""
echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\"$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms\""
}
function debloc_info {
@ -320,12 +335,17 @@ function debloc_altern_help {
return 0
}
function debloc_altern { # program alternative
if [ -z $1 || -z $2 ]; then
if [[ -z $1 || -z $2 ]]; then
debloc_altern_help
exit 1
fi
dest="$DEBLOC_ROOT/usr/bin/$1"
alte="$DEBLOC_ROOT/usr/bin/$1.$2"
if [ ! -f "$alt" ]; then
if [ -f "$DEBLOC_ROOT/usr/bin/$1.$2" ]; then
dest="$DEBLOC_ROOT/usr/bin/$1"
alte="$DEBLOC_ROOT/usr/bin/$1.$2"
elif [ -f "$DEBLOC_ROOT/bin/$1.$2" ]; then
dest="$DEBLOC_ROOT/bin/$1"
alte="$DEBLOC_ROOT/bin/$1.$2"
else
echo "Unknown alternative for $1 : $2"
exit 1
fi
@ -353,7 +373,7 @@ function debloc_help {
echo "Usage: $0 COMMAND"
echo
echo "Commands:"
echo " env Sets the environment variables required to run applications from the fake filesystem"
echo " env Provides the environment variables required to run applications from the fake filesystem"
echo " info Gives some information about the fake filesystem"
echo " install Install a debian package in the fake filesystem"
echo " deb Install from a .deb file in the fake filesystem"

View file

@ -54,7 +54,7 @@ if which pacman &> /dev/null; then
function installFileOne { # file
sudo pacman -U "$1"
}
if [ -f /usr/bin/yaourt ]; then
if which yaourt &> /dev/null; then
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
@ -162,13 +162,12 @@ function altInst {
}
# Common CLI
# Utils
inst grep sed sh tar
inst coreutils man openssl-tool grep sed sh tar
if [ $TERMUX == 1 ]; then
inst coreutils man termux-api openssl-tool
inst termux-api
if [ $ADMIN == 1 ]; then
inst tsu
fi
@ -200,7 +199,9 @@ if [ $TERMUX == 1 ]; then
inst vim-python
elif [ $DEBIAN == 1 ]; then
inst vim-nox
debloc altern vim nox
if [ $ADMIN == 0 ]; then
debloc altern vim nox
fi
else
inst vim
fi

View file

@ -19,7 +19,7 @@ function proxy_set {
export https_proxy=$1
export ftp_proxy=$1
export rsync_proxy=$1
echo "Proxy changed"
echo "Proxy set"
exit 0
}