From b1c271c0e4c0aa2453a688f2fb3a7d873debb073 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 2 Jun 2020 15:55:57 +0800 Subject: [PATCH] [feature] aarch64 support and bugfix --- ubuntu/install-base.sh | 5 +++-- ubuntu/install-fish.sh | 3 +++ ubuntu/install-sources.sh | 12 ++++++------ ubuntu/install-tmux.sh | 16 ++++++++++------ ubuntu/install-vim.sh | 2 ++ ubuntu/setup.sh | 7 +++++++ ubuntu/sources.aarch64.list | 8 ++++++++ ubuntu/{sources.list => sources.x86_64.list} | 0 8 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 ubuntu/sources.aarch64.list rename ubuntu/{sources.list => sources.x86_64.list} (100%) diff --git a/ubuntu/install-base.sh b/ubuntu/install-base.sh index c3fc17a..1d22c43 100755 --- a/ubuntu/install-base.sh +++ b/ubuntu/install-base.sh @@ -1,5 +1,6 @@ #!/bin/bash +set -e sudo apt update -sudo apt upgrade --fix-missing -sudo apt install build-essential automake pkg-config software-properties-common curl -y +sudo apt upgrade --fix-missing -y -q +sudo apt install build-essential automake pkg-config software-properties-common curl -y -q diff --git a/ubuntu/install-fish.sh b/ubuntu/install-fish.sh index 5375321..9a89a87 100755 --- a/ubuntu/install-fish.sh +++ b/ubuntu/install-fish.sh @@ -1,3 +1,6 @@ +#!/bin/bash + +set -e sudo add-apt-repository ppa:fish-shell/release-3 -y sudo apt update sudo apt install fish -y diff --git a/ubuntu/install-sources.sh b/ubuntu/install-sources.sh index 3c40b89..30235e9 100755 --- a/ubuntu/install-sources.sh +++ b/ubuntu/install-sources.sh @@ -1,13 +1,13 @@ #!/bin/bash +set -e + +DIR=$(dirname "${BASH_SOURCE[0]}") +ARCH=$(lscpu | head -n 1 | awk '{print $2}') 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 + SOURCE_CODENAME=$(head -n 1 $DIR/sources.$ARCH.list | cut -d' ' -f3) + sudo bash -c "sed s/$SOURCE_CODENAME/$CURRENT_CODENAME/g $DIR/sources.$ARCH.list > /etc/apt/sources.list" fi diff --git a/ubuntu/install-tmux.sh b/ubuntu/install-tmux.sh index d34215a..8af1d96 100755 --- a/ubuntu/install-tmux.sh +++ b/ubuntu/install-tmux.sh @@ -1,14 +1,18 @@ #!/bin/bash +set -e + sudo apt install libevent-dev libncurses5-dev -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 +#curl -L https://github.com/tmux/tmux/releases/download/$TMUX_VER/tmux-$TMUX_VER.tar.gz -o /tmp/tmux.tar.gz +curl -L https://gitee.com/klesh/tmux/repository/archive/$TMUX_VER?format=tar.gz -o /tmp/tmux.tar.gz +mkdir -p /tmp/tmux +tar zxvf /tmp/tmux.tar.gz -C /tmp/tmux +pushd /tmp/tmux +[ -f autogen.sh ] && sh autogen.sh ./configure && make sudo make install -cd -rm -rf /tmp/tmux-$TMUX_VER +rm -rf /tmp/tmux rm -rf /tmp/tmux.tar.gz +popd diff --git a/ubuntu/install-vim.sh b/ubuntu/install-vim.sh index 916b530..805857b 100755 --- a/ubuntu/install-vim.sh +++ b/ubuntu/install-vim.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + sudo add-apt-repository ppa:jonathonf/vim -y sudo apt update sudo apt install -y vim diff --git a/ubuntu/setup.sh b/ubuntu/setup.sh index b42f40f..f8bf637 100755 --- a/ubuntu/setup.sh +++ b/ubuntu/setup.sh @@ -1,9 +1,16 @@ #!/bin/bash +set -e + DIR=$(dirname "${BASH_SOURCE[0]}") +echo '=================== Replace sources.list ====================' $DIR/install-sources.sh +echo '=================== Installing basic packages ====================' $DIR/install-base.sh +echo '=================== Installing fish shell ====================' $DIR/install-fish.sh +echo '=================== Installing vim ====================' $DIR/install-vim.sh +echo '=================== Installing tmux ====================' $DIR/install-tmux.sh diff --git a/ubuntu/sources.aarch64.list b/ubuntu/sources.aarch64.list new file mode 100644 index 0000000..3b4bd45 --- /dev/null +++ b/ubuntu/sources.aarch64.list @@ -0,0 +1,8 @@ +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe +deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe +deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe diff --git a/ubuntu/sources.list b/ubuntu/sources.x86_64.list similarity index 100% rename from ubuntu/sources.list rename to ubuntu/sources.x86_64.list