-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitial.sh
executable file
·62 lines (52 loc) · 1.39 KB
/
initial.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
while true; do
read -p "Do you want to run $0? (y/n)" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 0;;
* ) echo "Please answer yes or no.";;
esac
done
# =====
# change apt mirror server
# =====
sudo sed -i.bak -e "s%http://\(jp\.\)*archive\.ubuntu\.com/ubuntu/%http://ftp.riken.go.jp/Linux/ubuntu/%g" /etc/apt/sources.list
# =====
# apt update/upgrade
# =====
(sudo apt update -y -qq && sudo apt upgrade -qq)
# =====
# install zsh
# =====
type zsh > /dev/null 2>&1 || sudo apt install -qq zsh
# =====
# set zsh and create ~/.zshrc
# =====
[ $SHELL == "$(which zsh)" ] || chsh -s $(which zsh)
ZSHENV="$HOME/.zshenv"
if ! [ -f $ZSHENV ]; then
echo export ZDOTDIR=\$HOME/dotfiles\\nsource \$ZDOTDIR/.zshenv\\n > $ZSHENV
fi
# =====
# remove unnnecessary files
# =====
ARCHIVEDIR="$HOME/.archives"
mkdir -p $ARCHIVEDIR
for i in $(cd $HOME; ls -A); do
if [ $HOME/$i != $(cd `dirname $0` && pwd) -a $HOME/$i != $ARCHIVEDIR -a $HOME/$i != $ZSHENV ]; then
mv $HOME/$i $ARCHIVEDIR
fi
done
# =====
# continue to setup.zsh
# =====
echo "\e[32m[Success to install ZSH]\e[m After restart terminal, \e[30;43m please run setup.sh \e[m"
while true; do
read -p "Do you restart terminal? (y/n)" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 0;;
* ) echo "Please answer yes or no.";;
esac
done
cmd.exe /c "wt.exe" -p "Ubuntu-18.04" && exit