[feature] avoid multiple package updating between installation
This commit is contained in:
parent
8fa8385cd0
commit
7c2833dfbe
|
@ -8,7 +8,7 @@ log 'Setting up shell'
|
|||
case "$PM" in
|
||||
apt)
|
||||
sudo add-apt-repository ppa:fish-shell/release-3 -y
|
||||
sudo apt update
|
||||
pm_update
|
||||
sudo apt install fish silversearcher-ag -y
|
||||
if [ "$DISTRIB_RELEASE_MAJOR" -gt 19 ] || [ "$DISTRIB_RELEASE" = "19.10" ]; then
|
||||
sudo apt install dash bat -y
|
||||
|
@ -49,7 +49,8 @@ if has_cmd bat; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if has_cmd dash; then
|
||||
# only for local machine with gui
|
||||
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
|
||||
log 'Setting up dash as default shell'
|
||||
sudo /usr/bin/ln -sfT dash /usr/bin/sh
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ set -e
|
|||
DIR=$(dirname "$(readlink -f "$0")")
|
||||
. "$DIR/../env.sh"
|
||||
|
||||
timedatectl set-ntp on
|
||||
sudo timedatectl set-ntp on
|
||||
. "$DIR/mirrors.sh"
|
||||
. "$DIR/basic.sh"
|
||||
. "$DIR/fish.sh"
|
||||
. "$DIR/vim.sh"
|
||||
. "$DIR/ranger.sh"
|
||||
. "$DIR/tmux.sh"
|
||||
. "$DIR/ranger.sh"
|
||||
|
|
|
@ -30,7 +30,7 @@ if ! has_cmd "$VIM"; then
|
|||
|
||||
# gui-common is required for clipboard integration
|
||||
sudo add-apt-repository ppa:jonathonf/vim -y
|
||||
sudo apt-get update
|
||||
pm_update
|
||||
sudo apt install -y vim vim-gui-common
|
||||
if enhance_vim; then
|
||||
sudo pip3 install pyvim
|
||||
|
|
19
env.sh
19
env.sh
|
@ -77,6 +77,23 @@ enhance_vim() {
|
|||
[ "$VIM_MODE" = "enhanced" ] && has_cmd nvim
|
||||
}
|
||||
|
||||
pm_update() {
|
||||
# skip updation on daily basis
|
||||
TSFILE=/tmp/apt_updated_at_$(date +%Y%m%d)
|
||||
CHECKSUM=$(md5sum $(find /etc/apt -type f | sort))
|
||||
grep -qF "$CHECKSUM" "$TSFILE" && return
|
||||
case "$PM" in
|
||||
apt)
|
||||
sudo apt update
|
||||
;;
|
||||
*)
|
||||
echo "unsupported os"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
echo "$CHECKSUM" > "$TSFILE"
|
||||
}
|
||||
|
||||
|
||||
sudo mkdir -p $PREFIX
|
||||
|
||||
|
@ -91,10 +108,10 @@ if [ "$PM" = "n/a" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
log "Environments"
|
||||
echo " PM : $PM"
|
||||
echo " DIR : $DIR"
|
||||
echo " PDIR : $PDIR"
|
||||
echo " PREFIX : $PREFIX"
|
||||
echo " GITHUB_PROXY : $GITHUB_PROXY"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user