From 800f6876889ac53d5bc7efb1d1b4bb5123bf5c34 Mon Sep 17 00:00:00 2001
From: Seth Boyles <sethboyles@gmail.com>
Date: Sat, 6 Feb 2021 00:11:17 +0000
Subject: [PATCH] Need to manually install dependencies rather than mixing apt
 reposwq

---
 Brewfile-core             |  1 -
 Brewfile-extra            |  1 -
 Brewfile-osx              |  4 ++++
 install-core.sh           |  3 ++-
 install-scripts/brew.sh   |  2 +-
 install-scripts/ubuntu.sh | 36 +++++++++++++++++++++++++++++-------
 6 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/Brewfile-core b/Brewfile-core
index 5a7f6e0..238212c 100644
--- a/Brewfile-core
+++ b/Brewfile-core
@@ -32,7 +32,6 @@ brew 'gti'
 
 # Language support
 brew 'go'
-brew 'ruby-install'
 brew 'node'
 brew 'python', link: true, overwrite: true
 brew 'shellcheck'
diff --git a/Brewfile-extra b/Brewfile-extra
index 072be64..d496189 100644
--- a/Brewfile-extra
+++ b/Brewfile-extra
@@ -6,7 +6,6 @@ tap 'neovim/neovim'
 brew 'ack'
 brew 'adr-tools'
 brew 'aria2'
-brew 'awscli'
 brew 'bash'
 brew 'bash-completion'
 brew 'bat'
diff --git a/Brewfile-osx b/Brewfile-osx
index 88d5b70..a13733c 100644
--- a/Brewfile-osx
+++ b/Brewfile-osx
@@ -5,6 +5,7 @@ brew 'fd'
 brew 'git-author'
 brew 'lastpass-cli'
 
+brew 'awscli'
 brew 'chruby'
 
 brew 'vault'
@@ -14,4 +15,7 @@ brew 'docker', overwrite: true, link: true
 brew 'postgresql@9.6', restart_service: true, link: true
 brew 'autojump'
 
+
+brew 'ruby-install'
+
 brew 'universal-ctags/universal-ctags/universal-ctags', args: ['HEAD']
diff --git a/install-core.sh b/install-core.sh
index 3ca756d..03b6a7c 100755
--- a/install-core.sh
+++ b/install-core.sh
@@ -19,6 +19,7 @@ else
 	IS_OSX=false
 	./install-scripts/ubuntu.sh
 fi
+
 # install brew and its packages
 source ./install-scripts/brew.sh
 if [ "$IS_OSX" = true ]; then
@@ -27,8 +28,8 @@ else
 	echo "Skipping Xcode installation for non OSX install"
 fi
 source ./install-scripts/brew-bundle.sh
-echo "Installing ruby"
 # ruby setup
+echo "Installing ruby"
 source ./install-scripts/ruby.sh
 source ./install-scripts/bundler.sh
 echo "Installing databases"
diff --git a/install-scripts/brew.sh b/install-scripts/brew.sh
index 68f2fb4..44eabe9 100755
--- a/install-scripts/brew.sh
+++ b/install-scripts/brew.sh
@@ -6,7 +6,7 @@ set -e
 function install_brew {
 	if ! which brew > /dev/null ; then
                 echo "Installing Homebrew"
-		/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
+		/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
 			</dev/null
 	fi
 	# to avoid ttyless complaints on brew update
diff --git a/install-scripts/ubuntu.sh b/install-scripts/ubuntu.sh
index d0e28f7..57bdc9d 100755
--- a/install-scripts/ubuntu.sh
+++ b/install-scripts/ubuntu.sh
@@ -2,7 +2,6 @@
 
 set -ex
 
-sudo apt-add-repository 'deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse'
 echo "Updating apt packages"
 sudo apt update
 echo "Upgrading Linux distribution"
@@ -11,17 +10,14 @@ sudo apt dist-upgrade -y
 sudo apt install -y \
   build-essential \
   docker.io \
-  fd-find \
-  libffi7 \
   libmysqlclient-dev \
   libpq-dev \
-  libpq5=12.2-4 \
+  libpq5 \
   libxslt-dev \
   mysql-server \
   postgresql \
   python-pip \
-  python-setuptools \
-  ripgrep
+  python-setuptools
 
 # fun dependencies
 sudo apt install -y \
@@ -39,7 +35,7 @@ if [[ ! -d ~/workspace/lastpass-cli ]]; then
 fi
 
 # linuxbrew doesn't install git stuff where we expect it to
-sudo ln -s /home/linuxbrew/.linuxbrew/share/git-core /usr/local/share/git-core
+sudo ln -sf /home/linuxbrew/.linuxbrew/share/git-core /usr/local/share/git-core
 
 pushd ~/workspace/lastpass-cli
   sudo apt install -y openssl libcurl4-openssl-dev libxml2 libssl-dev libxml2-dev pinentry-curses xclip cmake build-essential pkg-config
@@ -50,6 +46,32 @@ pushd ~/workspace/lastpass-cli
 popd
 
 pushd /tmp/
+  if ! command -v fd &> /dev/null
+  then
+    curl -LO https://github.com/sharkdp/fd/releases/download/v8.2.1/fd_8.2.1_amd64.deb
+    sudo dpkg -i fd_8.2.1_amd64.deb
+  fi
+
+  if ! command -v ripgrep &> /dev/null
+  then
+    curl -LO https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep_12.1.1_amd64.deb
+    sudo dpkg -i ripgrep_12.1.1_amd64.deb
+  fi
+
+
+  if ! command -v ruby-install &>/dev/null
+  then
+    wget -O ruby-install-0.8.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.8.1.tar.gz
+    tar -xzvf ruby-install-0.8.1.tar.gz
+    cd ruby-install-0.8.1/
+    sudo make install
+  fi
+
+
+  wget http://es.archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi7_3.3-4_amd64.deb
+  sudo dpkg -i libffi7_3.3-4_amd64.deb
+
+
   wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
   tar -xzvf chruby-0.3.9.tar.gz
   cd chruby-0.3.9/