-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·209 lines (184 loc) · 6.92 KB
/
make.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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
terminal() {
sudo cp target/release/alacritty /usr/local/bin # or anywhere else in $PATH
sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg
sudo desktop-file-install extra/linux/Alacritty.desktop
sudo update-desktop-database
sudo mkdir -p /usr/local/share/man/man1
gzip -c extra/alacritty.man | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null
}
polybar() {
wget http://mirrors.kernel.org/ubuntu/pool/universe/p/polybar/polybar_3.4.3-2_amd64.deb
sudo apt install --fix-broken ./polybar_3.4.3-2_amd64.deb
}
ubuntu() {
#for ubuntu server 20.04 minimal
sudo apt install git tmux vim curl -y
sudo apt install xinit
sudo apt install x11-xserver-utils xwallpaper
sudo apt install fonts-noto-cjk-extra
sudo apt install herbstluftwm --no-install-recommends --no-install-suggests
sudo apt install firefox --no-install-suggests --no-install-recommends
sudo apt install ffmpeg
sudo apt install pulseaudio pavucontrol
sudo apt install bluez pulseaudio-module-bluetooth
sudo systemctl enable --now bluetooth.service
sudo apt autoremove --purge snapd
sudo apt remove --purge unattended-upgrades
sudo apt-get install ifupdown
sudo systemctl disable --now systemd-networkd.socket systemd-networkd networkd-dispatcher systemd-networkd-wait-online
sudo apt autoremove --purge netplan.io
sudo rm -fr /etc/netplan
sudo rm -fr /etc/resolv.conf
sudo rm /etc/dhcp/dhclient-enter-hooks.d/resolved
cat <<EOF | sudo tee /etc/resolv.conf
nameserver 8.8.8.8
EOF
cat <<EOF | sudo tee /etc/network/interfaces
allow-hotplug wlp5s0
iface wlp5s0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
EOF
# edit the file to change wpa_supplicant cmds
cat <<EOF | sudo tee /etc/systemd/system/multi-user.target.wants/wpa_supplicant.service
[]
Description=WPA supplicant
Before=network.target
After=dbus.service
Wants=network.target
IgnoreOnIsolate=true
[Service]
Type=forking
BusName=fi.w1.wpa_supplicant1
ExecStart=/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -i wlp5s0 -B
[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service
EOF
# some common task want to be executed
cat <<EOF | sudo tee /etc/systemd/system/my-startup.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/libexec/my-startup-script
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF | sudo tee /usr/local/libexec/my-startup-script
setfont /usr/share/consolefonts/CyrAsia-TerminusBold32x16.psf.gz
EOF
# disable multipathd for network disks
sudo systemctl disable --now multipathd
# disable unused services
sudo apt autoremove accountsservice
sudo systemctl disable --now accounts-daemon
# reconfigure console fonts beside using setfont
sudo dpkg-reconfigure console-setup
# now install input method for chinese and other languages
sudo apt install fcitx-ui-classic --no-install-suggests --no-install-recommends
# required by gtk2/3, qt5, fbterm, firefox and other gui programs
sudo apt install fcitx-module-dbus fcitx-frontend-all fcitx-config-gtk --no-install-suggests --no-install-recommends
sudo apt install fcitx-libpinyin --no-install-suggests --no-install-recommends
# if use gui config tool, you dont need to manually change the profile
# sed -i 's/IMName=.*/IMName=pinyin-libpinyin/' ~/.config/fcitx/profile
# dual booting may require redo all below steps
bluetoothctl scan on
bluetoothctl trust 04:5D:4B:29:5A:DC
bluetoothctl pair 04:5D:4B:29:5A:DC
bluetoothctl connect 04:5D:4B:29:5A:DC
}
setup() {
sudo_apt
term
}
vm_disk_resize() {
virsh shutdown u16
sudo qemu-img resize /var/lib/libvirt/images/u16.qcow2 +40G
sudo qemu-img info /var/lib/libvirt/images/u16.qcow2
virsh start u16
ssh u16 sudo growpart /dev/vda 5
ssh u16 sudo reboot
ssh u16 sudo pvdisplay
ssh u16 sudo lvresize /dev/ubuntu-vg/root -L +40G
ssh u16 sudo resize2fs /dev/ubuntu-vg/root
ssh u16 sudo reboot
}
void() {
sudo xbps-install -S
sudo xbps-install git tmux curl aria2 wget
ln -s /etc/sv/dbus /var/service/dbus
sv start dbus
ln -s /etc/sv/alsa /var/service/alsa
sv start alsa
ln -s /etc/sv/wpa_supplicant /var/service/wpa_supplicant
sv start wpa_supplicant
# wpa_cli
# add_network 0
# set_network 0 ssid "name"
# set_network 0 password 123456
# enable_network 0
sudo xbps-install noto-fonts-cjk nerd-fonts
ln -s /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/50-user.conf /etc/fonts/conf.d/
ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/
#cjk input method
sudo xbps-install fcitx fcitx-libpinyin
sudo xbps-install libfcitx-gtk libfcitx-gtk3 libfcitx-qt libfcitx-qt5
#browser codec mp4 etc
sudo xbps-install firefox gst-libav
}
void_console() {
# /usr/share/kbd/consolefonts/solar24x32.psfu.gz
setfont solar24x32.psfu.gz
# swap escape and caps_lock for console
dumpkeys | sed s/Caps_Lock/Escape/ | loadkeys
# edit /etc/rc.conf to modify console settings and make the change persistent
# additional, set fbterm to allow unicode and input method to be used
}
android() {
git clone https://github.com/M0Rf30/android-udev-rules.git
cd android-udev-rules/
sudo cp 51-android.rules /usr/lib/udev/rules.d/
sudo chmod a+r /usr/lib/udev/rules.d/51-android.rules
sudo groupadd adbusers
sudo usermod -a -G adbusers robin
sudo udevadm control --reload-rules
sudo xi -S android-tools
adb devices
# copy file over
# adb push file /sdcard/directory
# adb shell
# adb shell <commands>
}
virt() {
sudo xi virt-manager libvirt qemu
sudo usermod -aG kvm robin
sudo modprobe kvm-amd
sudo gpasswd -a robin libvirt
sudo ln -s /etc/sv/libvirtd /var/service
sudo ln -s /etc/sv/virtlogd/ /var/service
sudo ln -s /etc/sv/virtlockd/ /var/service
virt-manager
# for void with GPU passthrough
# set iommu and pci.ids on kernel cmdline through update-grub
# amd_iommu=on iommu=pt vfio-pci.ids=1002:731f,1002:ab38
# for void initramfs, vfio-pci was built as kernel module
cat > /etc/dracut.conf.d/vfio.conf <<-EOF
hostonly="yes"
hostonly_cmdline="amd_iommu=on iommu=pt"
force_drivers+="vfio_pci vfio vfio_iommu_type1 vfio_virqfd"
EOF
uname -r
sudo xbps-reconfigure --force linux5.8
sudo dmesg | grep -i vfio
}
win_iso() {
curl --location --remote-name --remote-header-name https://github.com/WoeUSB/WoeUSB/raw/master/sbin/woeusb
chmod +x woeusb
sudo xi ntfs-3g wget parted
./woeusb --help
lsblk
sudo ./woeusb --target-filesystem NTFS -d Win10_20H2_Chinese\(Simplified\)_x64.iso /dev/sdb
}
"$@"