[bugfix] ubuntu release env-var / bat not working

This commit is contained in:
Klesh Wong 2021-01-17 15:30:01 +08:00
parent c59ea9601b
commit 3a46ca0e67
7 changed files with 21 additions and 30 deletions

View File

@ -14,13 +14,6 @@ case "$PM" in
openssh-client \
curl wget \
man sudo
if [ -f /etc/lsb-release ]; then
set -a
. /etc/lsb-release
set +a
export DISTRIB_RELEASE_MAJOR=${DISTRIB_RELEASE%.*}
export DISTRIB_RELEASE_MINOR=${DISTRIB_RELEASE#.*}
fi
;;
pacman)
sudo pacman -S --noconfirm --needed \

View File

@ -7,13 +7,15 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up shell'
case "$PM" in
apt)
sudo add-apt-repository ppa:fish-shell/release-3 -y
sudo add-apt-repository ppa:fish-shell/release-3 -y -n
pm_update
sudo apt install fish silversearcher-ag -y
echo DISTRIB_RELEASE_MAJOR: $DISTRIB_RELEASE_MAJOR
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
sudo apt install dash bat -y
fi
lnsf /usr/bin/batcat /usr/bin/bat
sudo ln -sf /usr/bin/batcat /usr/bin/bat
intorepo https://github.com/junegunn/fzf.git "$HOME/.fzf"
./install --all
exitrepo
@ -39,16 +41,6 @@ case "$PM" in
esac
if has_cmd bat; then
log 'Setting up bat'
BAT_THEMES="$(bat --config-dir)/themes"
BAT_GRUVBOX="$BAT_THEMES/gruvbox"
if [ ! -d "$BAT_GRUVBOX" ]; then
mkdir -p "$BAT_THEMES"
git_clone https://github.com/peaceant/gruvbox.git "$BAT_GRUVBOX"
fi
fi
# only for local machine with gui
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
log 'Setting up dash as default shell'

View File

@ -23,7 +23,7 @@ if status is-interactive
set -gx LS_COLORS 'ow=34;42;40'
# === bat configuration
set -gx BAT_THEME 'gruvbox'
set -gx BAT_THEME 'OneHalfDark'
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
# === dict.sh configuration

View File

@ -29,7 +29,7 @@ if ! has_cmd "$VIM"; then
#fi
# gui-common is required for clipboard integration
sudo add-apt-repository ppa:jonathonf/vim -y
sudo add-apt-repository ppa:jonathonf/vim -y -n
pm_update
sudo apt install -y vim vim-gui-common
if enhance_vim; then

View File

@ -19,9 +19,9 @@ case "$PM" in
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys \
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" -y -n
pm_update
sudo apt -y install cuda
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
sudo apt install nvidia-cuda-toolkit
else

10
env.sh
View File

@ -80,7 +80,7 @@ enhance_vim() {
pm_update() {
# skip updation on daily basis
TSFILE=/tmp/apt_updated_at_$(date +%Y%m%d)
CHECKSUM=$(md5sum $(find /etc/apt -type f | sort))
CHECKSUM=$(md5sum /etc/apt/sources.list /etc/apt/sources.list.d/*.list | sort | md5sum)
grep -qF "$CHECKSUM" "$TSFILE" && return
case "$PM" in
apt)
@ -107,6 +107,13 @@ if [ "$PM" = "n/a" ]; then
echo "Unsupported Package Manager"
exit 1
fi
if [ -f /etc/lsb-release ]; then
set -a
. /etc/lsb-release
set +a
export DISTRIB_RELEASE_MAJOR=${DISTRIB_RELEASE%.*}
export DISTRIB_RELEASE_MINOR=${DISTRIB_RELEASE#.*}
fi
log "Environments"
echo " PM : $PM"
@ -114,4 +121,3 @@ echo " DIR : $DIR"
echo " PDIR : $PDIR"
echo " PREFIX : $PREFIX"
echo " GITHUB_PROXY : $GITHUB_PROXY"

View File

@ -8,10 +8,10 @@ log 'Settingup office tools: libreoffice keepassxc nextcloud chrome zathura gimp
case "$PM" in
apt)
sudo add-apt-repository -y ppa:libreoffice/libreoffice-7-0
sudo add-apt-repository -y ppa:phoerious/keepassxc
sudo add-apt-repository -y ppa:nextcloud-devs/client
sudo apt update
sudo add-apt-repository -y -n ppa:libreoffice/libreoffice-7-0
sudo add-apt-repository -y -n ppa:phoerious/keepassxc
sudo add-apt-repository -y -n ppa:nextcloud-devs/client
pm_update
sudo apt install -y \
google-chrome-stable \
zathura zathura-pdf-poppler sxiv \