-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmyinit
executable file
·157 lines (154 loc) · 5.34 KB
/
myinit
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
# vim: set filetype=sh softtabstop=2 shiftwidth=2 smarttab cindent:
yesno() {
local yn
case $1 in
-c)
shift
read -r -p "$* [y/N] " yn
case $yn in
Y|y|yes)
eval "$@"
# do not use "true" here. keep command-status
;;
*)
false
;;
esac
return
;;
-h|-\?|--help)
echo 'usage: yesno "prompt"'
echo ' yesno -c command arg1 arg2 ...'
return
;;
esac
read -r -p "${*:-OK? [y/N]} " yn
case $yn in
Y|y|yes)
true
;;
*)
false
;;
esac
}
# init home dir
cd ~
mkdir save log backup install
if mkdir orig; then
if [ -z `type -t sudo` ]; then
# cygwin and git-for-windows have not "sudo"
cp -p .* orig/
cp -pr /etc orig/
else
sudo cp -p .* orig/
sudo cp -pr /etc orig/
fi
dpkg --get-selections > orig/pkg-selections.log
alias > orig/alias.log
printenv > orig/printenv.log
apt list > orig/apt-list.log
groups > orig/groups.log
fi
# mysetting
yesno -c LANG=C xdg-user-dirs-gtk-update
yesno -c sudo LANG=C dpkg-reconfigure keyboard-configuration
diff {~/orig/,/}etc/default/keyboard
# install minimum package
yesno -c sudo add-apt-repository ppa:git-core/ppa
sudo apt update ; sudo apt full-upgrade
sudo apt install vim git tig zip
# install option package
cat > install/mypkg << 'EOF'
## un-comment if you need.
#sudo apt install language-pack-ja && sudo update-locale LANG=ja_JP.UTF-8
#sudo apt install ripgrep
#sudo apt install dos2unix nkf
#sudo apt install eza
#sudo apt install fzf
#sudo apt install p7zip-full
#sudo apt install zstd
#sudo apt install rar
#sudo apt install xsel # need X11
#sudo apt install fdclone vifm
#sudo apt install gh
#sudo apt install git-svn
#sudo apt install git-cvs
#sudo apt install subversion
#sudo apt install make
#sudo apt install build-essential libtool automake autoconf pkg-config
#sudo apt install cpanminus
#sudo apt install npm && npm -g install electron
#sudo apt install golang
#sudo apt install rustc
#sudo apt install lua5.3
#sudo apt install ziglang
#sudo apt install libimage-exiftool-perl
#sudo apt install libflickr-upload-perl
#sudo apt install astronomical-almanac
#sudo apt install terminator
#sudo apt install plantuml
#sudo apt install google-chrome-stable
#sudo apt install network-manager
#sudo apt install whois
#sudo apt install neovim
#sudo apt install ffmpeg
#sudo apt install imagemagick
#sudo apt install graphicsmagick
#sudo apt install graphicsmagick-imagemagick-compat
#sudo apt-get autoremove
## === ubuntu-ja
## https://www.ubuntulinux.jp/News/ubuntu2404-ja-remix
## Japanese Teamのパッケージレポジトリを追加する.
## リポジトリ追加後、パッケージ情報の更新時に以下の警告が表示されますが、これはUbuntu 24.04 LTSから1024ビットRSAによるAPTリポジトリ署名鍵が非推奨になったことによるものです。
## Launchpad PPAでの再署名と鍵の更新が完了後、この警告は表示されなくなる予定です。
## W: http://archive.ubuntulinux.jp/ubuntu/dists/noble/InRelease: Signature by key 59676CBCF5DFD8C1CEFE375B68B5F60DCDC1D865 uses weak algorithm (rsa1024)
#sudo wget https://www.ubuntulinux.jp/sources.list.d/noble.sources -O /etc/apt/sources.list.d/ubuntu-ja.sources
#sudo apt -U upgrade
#sudo apt install ubuntu-defaults-ja
## === code
#GPGKEY=/usr/share/keyrings/microsoft-packages-keyring.gpg
#curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o $GPGKEY
#echo "deb [arch=amd64 signed-by=$GPGKEY] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
#sudo apt update ; sudo apt install code
## === google-chrome-stable
#GPGKEY=/usr/share/keyrings/google-dl-keyring.gpg
#curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o $GPGKEY
#echo "deb [arch=amd64 signed-by=$GPGKEY] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
#sudo apt update ; sudo apt install google-chrome-stable
## === anydesk
## http://deb.anydesk.com/howto.html
#GPGKEY=/usr/share/keyrings/anydesk-keyring.gpg
#curl -fsSL https://keys.anydesk.com/repos/DEB-GPG-KEY | sudo gpg --dearmor -o $GPGKEY
#echo "deb [arch=amd64 signed-by=$GPGKEY] http://deb.anydesk.com/ all main" | sudo tee /etc/apt/sources.list.d/anydesk-stable.list
#sudo apt update ; sudo apt install anydesk
EOF
vim install/mypkg ; source install/mypkg
# WSL patch
if yesno "WSL [y/N]"; then
cat <<-'EOF' | sudo tee -a /etc/wsl.conf
# global setting is: ${USERPROFILES}/.wslconfig
# ------
# avoid to lost focus on WindowsApp by WSL <https://jiyuukaitakusha.com/howto-deal-focus-loss/>
#[wsl2]
#guiApplications=false
# ------
# avoid => WSL (1015) ERROR: UtilTranslatePathList:2866: Failed to translate X:\path\to\windows-network-drive
[interop]
appendWindowsPath=false
EOF
EDITOR=vim sudoedit /etc/wsl.conf
fi
# init shell and git
yesno -c git clone https://github.com/hkuno9000/cygbin.git bin
if yesno "git user.name/email hkuno [y/N]"; then
git config --global user.name "Hiroshi Kuno"
git config --global user.email "[email protected]"
fi
##curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh > bin/git-prompt.sh
yesno -c bash -c bin/initmyrc
yesno -c bash -c bin/initbashrc
vim -c '/^##' .bashrc
yesno -c bash -c bin/mygitconf
# end