-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
457 lines (396 loc) ยท 12.3 KB
/
install.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
#!/bin/bash
# ๋ฃจํธ ๊ถํ ํ์ธ
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
# ๋ชจ๋ ํ๋ ๋๋ผ์ด๋ธ ํ์
clear
echo "Here are all the hard drives in the system:"
drives=($(lsblk -d -o NAME,SIZE,TYPE | grep disk | nl -w2 -s'. ' | awk '{print $2}'))
lsblk -d -o NAME,SIZE,TYPE | grep disk | nl -w2 -s'. '
# ๋๋ผ์ด๋ธ ์ ํ
read -p "Please enter the number of the desired hard drive (e.g., 1, 2, etc.): " choice
# ์ ํ ์ ํจ์ฑ ๊ฒ์ฌ
if [[ $choice -gt 0 && $choice -le ${#drives[@]} ]]; then
DEVICE="/dev/${drives[$choice-1]}"
echo "Selected hard drive: $DEVICE"
else
echo "Invalid number. Exiting..."
exit 1
fi
# CPU ์ ํ ์ ํ ํ์
clear
echo "Select your CPU type:"
echo "1. Intel"
echo "2. AMD"
read -p "Enter your choice (1 or 2): " cpu_choice
case $cpu_choice in
1)
CPU_UCODE="intel-ucode"
;;
2)
CPU_UCODE="amd-ucode"
;;
*)
echo "Invalid choice. Exiting..."
exit 1
;;
esac
# ์ฌ์ฉ์ ์ ๋ณด ํ์ธ
# ์ฌ์ฉ์ ์ด๋ฆ ๋ฐ๊ธฐ
while true; do
read -p "Enter username: " input_username
if [ -n "$input_username" ]; then
USERNAME="$input_username"
# ์ฌ์ฉ์ ์ด๋ฆ์ด "crux"์ธ ๊ฒฝ์ฐ ๊ธฐ๋ณธ๊ฐ ์ค์ ๋ฐ ๋ค๋ฅธ ํ๋กฌํํธ ๊ฑด๋๋ฐ๊ธฐ
if [ "$USERNAME" = "crux" ]; then
HOSTNAME="lia"
ROOT_PASSWORD="1234"
USER_PASSWORD="1234"
echo "Default values set for code owner installation ๐."
break
fi
break
else
echo "Username cannot be empty. Please try again."
fi
done
# ์ฌ์ฉ์ ์ด๋ฆ์ด "crux"๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง ๊ณ์ ์งํ
if [ "$USERNAME" != "crux" ]; then
# ํธ์คํธ๋ช
๋ฐ๊ธฐ
while true; do
read -p "Enter hostname: " input_hostname
if [ -n "$input_hostname" ]; then
HOSTNAME="$input_hostname"
break
else
echo "Hostname cannot be empty. Please try again."
fi
done
# ๋ฃจํธ ๋น๋ฐ๋ฒํธ ๋ฐ๊ธฐ
while true; do
read -s -p "Enter root password: " input_root_pass
echo
read -s -p "Confirm root password: " input_root_pass2
echo
if [ -z "$input_root_pass" ]; then
echo "Password cannot be empty. Please try again."
continue
fi
if [ "$input_root_pass" = "$input_root_pass2" ]; then
ROOT_PASSWORD="$input_root_pass"
break
else
echo "Passwords do not match. Please try again."
fi
done
# ์ฌ์ฉ์ ๋น๋ฐ๋ฒํธ ๋ฐ๊ธฐ
while true; do
read -s -p "Enter user password: " input_user_pass
echo
read -s -p "Confirm user password: " input_user_pass2
echo
if [ -z "$input_user_pass" ]; then
echo "Password cannot be empty. Please try again."
continue
fi
if [ "$input_user_pass" = "$input_user_pass2" ]; then
USER_PASSWORD="$input_user_pass"
break
else
echo "Passwords do not match. Please try again."
fi
done
fi
# ์ฅ์น ์ ํ์ ๋ฐ๋ฅธ ํํฐ์
๋ณ์ ์ค์
if [[ ${DEVICE} == *"nvme"* ]]; then
EFI_PART="${DEVICE}p1"
SWAP_PART="${DEVICE}p2"
ROOT_PART="${DEVICE}p3"
else
EFI_PART="${DEVICE}1"
SWAP_PART="${DEVICE}2"
ROOT_PART="${DEVICE}3"
fi
# ์ด RAM ํ์ธ ๋ฐ ๊ถ์ฅ ์ค์ ํฌ๊ธฐ ๊ณ์ฐ
TOTAL_RAM=$(grep MemTotal /proc/meminfo | awk '{print $2}')
TOTAL_RAM_GB=$((TOTAL_RAM / 1024 / 1024))
# RAM ๊ธฐ๋ฐ ๊ถ์ฅ ์ค์ ํฌ๊ธฐ ๊ณ์ฐ
if [ ${TOTAL_RAM_GB} -le 8 ]; then
# RAM โค 8GB์ธ ๊ฒฝ์ฐ, ๋์ผํ ์ค์ ํฌ๊ธฐ ์ฌ์ฉ
SWAP_SIZE=${TOTAL_RAM_GB}
elif [ ${TOTAL_RAM_GB} -le 64 ]; then
# RAM์ด 8GB์์ 64GB ์ฌ์ด์ธ ๊ฒฝ์ฐ, RAM ํฌ๊ธฐ์ ์ ๋ฐ ์ฌ์ฉ
SWAP_SIZE=$((TOTAL_RAM_GB / 2))
else
# RAM > 64GB์ธ ๊ฒฝ์ฐ, 32GB ์ค์์ผ๋ก ์ ํ
SWAP_SIZE=32
fi
# RAM ํฌ๊ธฐ์ ๋ฐ๋ฅธ ์ค์์ฑ ์ค์
if [ ${TOTAL_RAM_GB} -gt 32 ]; then
SWAPPINESS=10 # ๋์ RAM ์์คํ
์ ๊ฒฝ์ฐ ๋ฎ์ ์ค์์ฑ
else
SWAPPINESS=60 # ๋ฎ์ RAM ์์คํ
์ ๊ฒฝ์ฐ ๋์ ์ค์์ฑ
fi
# ์ค์น ๊ณํ ํ์
echo "==========================="
echo "Installation Plan:"
echo "Device: ${DEVICE}"
echo "EFI: ${EFI_PART}"
echo "Swap: ${SWAP_PART}"
echo "Swappiness: ${SWAPPINESS}"
echo "Root: ${ROOT_PART}"
echo "Username: ${USERNAME}"
echo "Hostname: ${HOSTNAME}"
echo "CPU Type: ${CPU_UCODE}"
echo "==========================="
echo "WARNING: This will COMPLETELY ERASE the selected drive!"
echo "Press Ctrl+C within 3 seconds to cancel..."
sleep 3
# pacman ์ด๊ธฐํ
pacman-key --init
pacman-key --populate archlinux
pacman -Sy archlinux-keyring
# ๋์คํฌ ์ ๋ฆฌ
echo "Cleaning disk..."
dd if=/dev/zero of=${DEVICE} bs=1M count=100
dd if=/dev/zero of=${DEVICE} bs=1M seek=$(( $(blockdev --getsz ${DEVICE}) / 2048 - 100)) count=100
wipefs -af ${DEVICE}
sgdisk -Z ${DEVICE}
# ์ GPT ์์ฑ
sgdisk -o ${DEVICE}
# ํํฐ์
์์ฑ
sgdisk -n 1:0:+1G -t 1:ef00 -c 1:"EFI System Partition" ${DEVICE}
sgdisk -n 2:0:+${SWAP_SIZE}G -t 2:8200 -c 2:"Linux swap" ${DEVICE}
sgdisk -n 3:0:0 -t 3:8300 -c 3:"Linux root" ${DEVICE}
# ์ปค๋์ด ํํฐ์
ํ
์ด๋ธ์ ์
๋ฐ์ดํธํ ๋๊น์ง ๋๊ธฐ
sleep 3
partprobe ${DEVICE}
sleep 3
clear
# ๋ฐ์คํฌํฑ ํ๊ฒฝ ์ ํ
echo "Select your desktop environment:"
echo "1) KDE Plasma (verified)"
echo "2) GNOME (verified)"
echo "3) XFCE (verified)"
echo "4) Awesome WM (for experts only)"
echo "5) DWM (for experts only)"
echo "6) Cinnamon (verified)"
echo "7) Hyprland (for experts only)"
read -p "Enter your choice (1-7): " de_choice
case $de_choice in
1) # KDE Plasma
DE_PACKAGES="plasma wayland plasma-desktop plasma-wayland-protocols kde-applications sddm"
DM_SERVICE="sddm"
;;
2) # GNOME
DE_PACKAGES="gnome gnome-extra gdm"
DM_SERVICE="gdm"
;;
3) # XFCE
DE_PACKAGES="xfce4 xfce4-goodies lightdm lightdm-gtk-greeter thunar lxsession rxvt-unicode"
DM_SERVICE="lightdm"
;;
4) # Awesome WM
DE_PACKAGES="awesome lightdm lightdm-gtk-greeter thunar"
DM_SERVICE="lightdm"
;;
5) # DWM
DE_PACKAGES="dwm st dmenu ghostty thunar"
DM_SERVICE="none"
;;
6) # Cinnamon
DE_PACKAGES="cinnamon lightdm lightdm-gtk-greeter"
DM_SERVICE="lightdm"
;;
7) # Hyprland
DE_PACKAGES="hyprcursor hyprutils aquamarine hypridle hyprlock hyprland pyprland hyprland-qtutils waybar swaybg swaylock swayidle wlogout mako grim slurp wl-clipboard thunar"
DM_SERVICE="sddm"
;;
*)
echo "Invalid choice. Exiting..."
exit 1
;;
esac
# ํํฐ์
ํฌ๋งท
clear
echo "Formatting partitions..."
mkfs.fat -F 32 ${EFI_PART}
mkswap ${SWAP_PART}
mkfs.ext4 ${ROOT_PART}
# ํํฐ์
๋ง์ดํธ
clear
echo "Mounting partitions..."
mount ${ROOT_PART} /mnt
mkdir -p /mnt/boot
mount ${EFI_PART} /mnt/boot
swapon ${SWAP_PART}
clear
# ๊ธฐ๋ณธ ์์คํ
์ค์น
echo "Installing base system..."
pacstrap -K /mnt base linux linux-firmware base-devel ${CPU_UCODE} \
networkmanager terminus-font vim efibootmgr \
pipewire pipewire-alsa pipewire-jack \
reflector dhcpcd bash-completion \
sudo btrfs-progs htop pacman-contrib pkgfile less \
git curl wget zsh openssh man-db \
xorg xorg-server xorg-apps xorg-drivers xorg-xkill xorg-xinit xterm \
mesa libx11 libxft libxinerama freetype2 noto-fonts-emoji usbutils xdg-user-dirs \
konsole bluez bluez-utils blueman --noconfirm
# fstab ์์ฑ
clear
echo "Generating fstab..."
genfstab -U /mnt >> /mnt/etc/fstab
# ์ ํํ ๋ฐ์คํฌํฑ ํ๊ฒฝ ์ค์น
clear
echo "Installing selected desktop environment..."
arch-chroot /mnt pacman -S --noconfirm ${DE_PACKAGES}
# ํด๋น๋๋ ๊ฒฝ์ฐ ๋์คํ๋ ์ด ๋งค๋์ ํ์ฑํ
if [[ $DM_SERVICE != "none" ]]; then
arch-chroot /mnt systemctl enable ${DM_SERVICE}
fi
# ๋คํธ์ํฌ ํ์ฑํ
arch-chroot /mnt systemctl enable NetworkManager
# ์์คํ
๊ตฌ์ฑ
arch-chroot /mnt /bin/bash <<CHROOT_COMMANDS
# ์๊ฐ๋๋ฅผ ๋ํ๋ฏผ๊ตญ์ผ๋ก ์ค์
ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
hwclock --systohc
# ์๊ฐ ๋๊ธฐํ ํ์ฑํ
systemctl enable systemd-timesyncd
# ๋ก์ผ์ผ ์ค์
echo "ko_KR.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=ko_KR.UTF-8" > /etc/locale.conf
# ํธ์คํธ๋ช
์ค์
echo "${HOSTNAME}" > /etc/hostname
cat > /etc/hosts <<EOF
127.0.0.1 localhost
::1 localhost
127.0.1.1 ${HOSTNAME}.localdomain ${HOSTNAME}
EOF
# ์ฌ์ฉ์ ์์ฑ ๋ฐ ๋น๋ฐ๋ฒํธ ์ค์
echo "root:${ROOT_PASSWORD}" | chpasswd
useradd -m -G wheel,audio,video,optical,storage -s /bin/bash ${USERNAME}
echo "${USERNAME}:${USER_PASSWORD}" | chpasswd
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/wheel
# ๋ฐ์คํฌํฑ ํ๊ฒฝ ์ ํ์ ๋ฐ๋ฅธ ์๋ ๋ก๊ทธ์ธ ๊ตฌ์ฑ
case $de_choice in
1) # KDE Plasma (SDDM)
mkdir -p /etc/sddm.conf.d
cat > /etc/sddm.conf.d/autologin.conf <<EOF
[Autologin]
User=${USERNAME}
Session=plasma.desktop
Relogin=false
EOF
;;
2) # GNOME (GDM)
mkdir -p /etc/gdm
cat > /etc/gdm/custom.conf <<EOF
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=${USERNAME}
[security]
[xdmcp]
[chooser]
[debug]
EOF
;;
*) # ๋ค๋ฅธ ๋ชจ๋ DE - ์๋ ๋ก๊ทธ์ธ ๊ตฌ์ฑ ์์
# ๊ธฐ๋ณธ ๋ก๊ทธ์ธ ๋์ ์ฌ์ฉ
;;
esac
# ๋ถํธ๋ก๋ ์ค์น ๋ฐ ๊ตฌ์ฑ
bootctl install
mkdir -p /boot/loader/entries
cat > /boot/loader/loader.conf <<EOF
default arch.conf
timeout 0
console-mode max
editor no
EOF
cat > /boot/loader/entries/arch.conf <<EOF
title Arch Linux
linux /vmlinuz-linux
initrd /${CPU_UCODE}.img
initrd /initramfs-linux.img
options root=PARTUUID=$(blkid -s PARTUUID -o value ${ROOT_PART}) rw quiet
EOF
# ์ถ๊ฐ ํจํค์ง ์ค์น
clear
pacman -Sy --noconfirm
# ํ๊ธ ํฐํธ ๋ฐ ์
๋ ฅ๊ธฐ ์ค์น
pacman -S --noconfirm \
noto-fonts-cjk noto-fonts-emoji \
adobe-source-han-sans-kr-fonts adobe-source-han-serif-kr-fonts ttf-baekmuk \
powerline-fonts nerd-fonts ttf-lato \
libhangul fcitx5 fcitx5-configtool fcitx5-hangul fcitx5-gtk fcitx5-qt \
libreoffice-fresh libreoffice-fresh-ko
fcitx-hangul firefox-i18n-ko gimp-help-ko ibus-hangul
texlive-langcjk texlive-langkorean thunderbird-i18n-ko ttf-baekmuk
# ํ๋ก๊ทธ๋๋ฐ ์ธ์ด ๋ฐ ๊ฐ๋ฐ ๋๊ตฌ ์ค์น
pacman -S --noconfirm \
firefox thunderbird thunderbird-i18n-ko \
flatpak remmina opentofu chromium code \
describeimage fortunecraft llm-manager ollama ollama-docs ghostty \
7zip blas64-openblas fftw libblastrampoline libgit2 libunwind libutf8proc lld llvm-julia-libs mbedtls2 openlibm pcre2 suitesparse \
gnuplot cmake gcc-fortran libwhich llvm-julia patchelf python git base-devel cmake pkg-config \
gtk3 gtk4 qt5-base qt6-base libxcb libdbus fontconfig freetype2 libxkbcommon clang noto-fonts-cjk cargo
# fcitx5 ํ๊ธ ์
๋ ฅ๊ธฐ ํ๋กํ ๊ตฌ์ฑ
cat > /home/${USERNAME}/.config/fcitx5/profile <<EOF
[Groups/0]
Name=Default
Default Layout=us
DefaultIM=hangul
[Groups/0/Items/0]
Name=keyboard-us
Layout=us
[Groups/0/Items/1]
Name=hangul
Layout=kr
[GroupOrder]
0=Default
EOF
# fcitx5๋ฅผ ์ํ ํ๊ฒฝ ๋ณ์ ์ค์
mkdir -p /home/${USERNAME}/.config/environment.d
cat > /home/${USERNAME}/.config/environment.d/fcitx5.conf <<EOF
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
EOF
# fcitx5 ์๋ ์์ ์ค์
mkdir -p /home/${USERNAME}/.config/autostart
cat > /home/${USERNAME}/.config/autostart/fcitx5.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Fcitx5
Exec=fcitx5
Comment=Start Fcitx5 input method
EOF
# ์ค์ ํ์ผ์ ์์ ๊ถ์ ์ฌ์ฉ์๋ก ๋ณ๊ฒฝ
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.config
# ์ค์์ฑ ์ค์
echo "vm.swappiness=${SWAPPINESS}" > /etc/sysctl.d/99-swappiness.conf
# initramfs ์์ฑ
mkinitcpio -P
CHROOT_COMMANDS
# ํํฐ์
๋ง์ดํธ ํด์
umount -R /mnt
clear
echo "Installation complete!"
echo ""
echo "IMPORTANT POST-INSTALLATION STEPS:"
echo "1. Power off the computer completely (not reboot)"
echo "2. Remove the USB drive"
echo "3. Enter BIOS setup and make these changes:"
echo " a. Load BIOS defaults first"
echo " b. Disable Secure Boot"
echo " c. Set UEFI boot mode (disable CSM/Legacy completely)"
echo " d. Set Boot Device Priority to ${DEVICE}"
echo ""
echo "After first boot:"
echo "1. Korean input can be toggled with Shift+Space"
echo "2. Run 'fcitx5-configtool' to configure input method"
echo "3. Use 'fcitx5 --debug &' if you need to troubleshoot"