mirror of
https://github.com/chenasraf/dotfiles.git
synced 2026-05-18 01:29:06 +00:00
feat: platform_install - add dpkg-url option
This commit is contained in:
@@ -115,13 +115,8 @@ fi
|
||||
if [[ ! -f $(which delta) ]]; then
|
||||
if ask "Install delta?"; then
|
||||
echo_yellow "Installing delta..."
|
||||
if is_mac; then
|
||||
platform_install git-delta
|
||||
else
|
||||
tmpf=$(mktemp -d)/delta.deb
|
||||
curl -L https://github.com/dandavison/delta/releases/download/0.17.0/git-delta_0.17.0_amd64.deb -o $tmpf
|
||||
dpkg -i $tmpf
|
||||
fi
|
||||
dpkg_url="https://github.com/dandavison/delta/releases/download/0.17.0/git-delta_0.17.0_amd64.deb"
|
||||
platform_install --dpkg-url $dpkg_url git-delta
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -706,12 +706,30 @@ peerdepls() {
|
||||
}
|
||||
|
||||
platform_install() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo_red "Usage: platform_install [--dpkg-url dpkg-url] <package>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $# -gt 1 ]]; then
|
||||
case $1 in
|
||||
--dpkg-url)
|
||||
dpkg_url=$2
|
||||
shift 2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
pkg="$@"
|
||||
|
||||
if is_mac; then
|
||||
brew install $pkg
|
||||
elif is_linux; then
|
||||
sudo apt install $pkg
|
||||
if [[ ! -z "$dpkg_url" ]]; then
|
||||
curl -sL $dpkg_url | sudo dpkg -i
|
||||
else
|
||||
sudo apt install $pkg
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user