[misc] split to multiple install script

This commit is contained in:
Klesh Wong 2020-05-14 20:21:27 +08:00
parent 3f58724007
commit 8f4e31286e
7 changed files with 49 additions and 39 deletions

5
ubuntu/install-base.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
sudo apt update
sudo apt upgrade --fix-missing
sudo apt install fish build-essential automake pkg-config libevent-dev libncurses5-dev software-properties-common curl -y

9
ubuntu/install-fish.sh Executable file
View File

@ -0,0 +1,9 @@
sudo add-apt-repository ppa:fish-shell/release-3 -y
sudo apt update
sudo apt install fish -y
DEFAULT_SHELL=$(getent passwd $USER | cut -d: -f7)
FISH_SHELL=$(which fish)
if [ "$DEFAULT_SHELL" != "$FISH_SHELL" ]; then
chsh -s $FISH_SHELL
fi

13
ubuntu/install-sources.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
if [ ! -e /etc/apt/sources.bak ]; then
sudo mv /etc/apt/sources.list /etc/apt/sources.bak
CURRENT_CODENAME=$(lsb_release -c | cut -f2)
SOURCE_CODENAME=$(head -n 1 $DIR/sources.list | cut -d' ' -f3)
if [ "$CURRENT_CODENAME" != "$SOURCE_CODENAME" ]; then
sudo bash -c "cat $DIR/sources.list | sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g > /etc/apt/sources.list"
else
sudo cp $DIR/sources.list /etc/apt/
fi
fi

12
ubuntu/install-tmux.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
TMUX_VER=3.1b
curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz
cd /tmp/
tar zxvf tmux.tar.gz
cd tmux-$TMUX_VER
./configure && make
sudo make install
cd
rm -rf /tmp/tmux-$TMUX_VER
rm -rf /tmp/tmux.tar.gz

5
ubuntu/install-vim.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
sudo add-apt-repository ppa:jonathonf/vim -y
sudo apt update
sudo apt install -y vim

View File

@ -1,43 +1,9 @@
#!/bin/bash
DIR=$(dirname "${BASH_SOURCE[0]}")
if [ ! -e /etc/apt/sources.bak ]; then
sudo mv /etc/apt/sources.list /etc/apt/sources.bak
CURRENT_CODENAME=$(lsb_release -c | cut -f2)
SOURCE_CODENAME=$(head -n 1 $DIR/sources.list | cut -d' ' -f3)
if [ "$CURRENT_CODENAME" != "$SOURCE_CODENAME" ]; then
sudo bash -c "cat $DIR/sources.list | sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g > /etc/apt/sources.list"
else
sudo cp $DIR/sources.list /etc/apt/
fi
fi
sudo add-apt-repository ppa:jonathonf/vim -y
sudo add-apt-repository ppa:fish-shell/release-3 -y
sudo apt-get update
sudo apt-get upgrade --fix-missing
sudo apt-get install vim fish build-essential automake pkg-config libevent-dev libncurses5-dev software-properties-common curl -y
TMUX_VER=3.1b
curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz
cd /tmp/
tar zxvf tmux.tar.gz
cd tmux-$TMUX_VER
./configure && make
sudo make install
cd
rm -rf /tmp/tmux-$TMUX_VER
rm -rf /tmp/tmux.tar.gz
#if uname -r | grep "Microsoft" -q; then
#if ! grep fish ~/.bashrc -q; then
#cat $DIR/wsl.sh >> ~/.bashrc
#fi
#else
DEFAULT_SHELL=$(getent passwd $USER | cut -d: -f7)
FISH_SHELL=$(which fish)
if [ "$DEFAULT_SHELL" != "$FISH_SHELL" ]; then
chsh -s $FISH_SHELL
fi
#fi
$DIR/install-sources.sh
$DIR/install-base.sh
$DIR/install-fish.sh
$DIR/install-vim.sh
$DIR/install-tmux.sh

0
ubuntu/sources.list Executable file → Normal file
View File