1
0
hugo/content/blog/2022-02-19-usb.md

115 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2024-04-23 13:21:26 +00:00
+++
date = "2022-02-19"
tags = ["arch","usb"]
title = "usbのarchもswayにしてみた"
slug = "usb"
+++
```sh
$ cfdisk /dev/sdb
# /dev/sdb1 : 200M, EFI
# /dev/sdb2 : 26G, linux
$ mkfs.ext4 /dev/sdb2
$ mkfs.vfat /dev/sdb1
$ mount /dev/sdb2 /mnt
$ pacstrap /mnt base base-devel linux
# paru(rust)のbuildは時間がかかりすぎるし、usbには読み書き負担が大きすぎるのでbinaryを持ってきたほうがいいです
$ which paru
$ cp /bin/paru /mnt/bin/
$ arch-chroot /mnt
$ useradd -m -G wheel -s /bin/zsh syui
$ passwd
$ passwd syui
$ echo -e 'Defaults env_keep += "HOME"\n%wheel ALL=(ALL) ALL' >> /mnt/etc/sudoers
$ echo -e '%wheel ALL=(ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/reboot, /usr/bin/poweroff' >> /mnt/etc/sudoers
$ pacman -S grub dhcpcd vim zsh tmux git go openssh net-tools sway xorg-xwayland waybar lightdm lightdm-gtk-greeter networkmanager network-manager-applet blueman pulseaudio pavucontrol udevil pcmanfm chromium fcitx5 fcitx5-mozc
# grubは様々なマシンをbootできるimgからもってきてcfgを再構築するといいです
$ exit
$ cp -rf /boot/{efi,boot} /mnt/boot
$ arch-chroot /mnt
$ grub-mkconfig -o /boot/grub/grub.cfg
# macbook-air特有の問題に対処
$ pacman -S broadcom-wl
$ vim /etc/mkinitcpio.conf
HOOKS="base udev block autodetect modconf filesystems keyboard fsck"
$ mkinitcpio -p linux
$ ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
$ vim /etc/systemd/network/eth.network
[Match]
Name=eth0
[Network]
#DHCP=ipv4
Address=192.168.1.xx
Gateway=192.168.1.xx
DNS=192.168.1.1
$ sudo systemctl enable NetworkManager
$ sudo systemctl enable systemd-networkd
$ vim /etc/lightdm/lightdm.conf
[Seat:*]
autologin-user=syui
autologin-user-timeout=0
autologin-session=sway
$ groupadd -r autologin
$ gpasswd -a USERNAME autologin
$ sudo systemctl enable lightdm
$ vim /etc/locale.gen
$ locale-gen
$ touch .xprofile
# paru -S numix-gtk-theme numix-icon-theme-git
$ paru -S arc-icon-theme arc-gtk-theme ttf-font-awesome
$ ls /usr/share/{icon*,theme*,font*}
$ cp /usr/share/gtk-2.0/gtkrc ~/.gtkrc-2.0
$ vim ~/.gitrc-2.0
gtk-icon-theme-name = "Arc"
gtk-theme-name = "Arc"
gtk-font-name = "awesome-terminal-fonts"
$ sudo systemctl restart lightdm
$ pcmanfm
```
```
$ pacman -S powerline zsh-syntax-highlighting
$ source /usr/share/powerline/bindings/zsh/powerline.zsh
$ source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
```
### vpnに接続する方法
まずは、pritunl-serverを立ち上げて、profileをdownload(or rewirte)します。
次に、clientを使い接続します。この辺の仕組みは一度構築すると便利に使えます。usbは外で使う事が多く、local-networkに入るための手段を確立しておくことは重要です。
```sh:/etc/pacman.conf
[pritunl]
Server = https://repo.pritunl.com/stable/pacman
```
```sh
$ sudo pacman-key --keyserver hkp://keyserver.ubuntu.com -r 7568D9BB55FF9E5287D586017AE645C0CF8E292A
$ sudo pacman-key --lsign-key 7568D9BB55FF9E5287D586017AE645C0CF8E292A
$ sudo pacman -Sy
$ sudo pacman -S pritunl-client-electron
$ sudo pacman -S pritunl-client-electron-numix-theme
$ pritunl-client-electron
# ここでprofile(.vpn)をimport
$ git clone https://github.com/cghdev/gotunl.git
$ cd gotunl
$ go install
$ ./${GOPATH}/bin/gotunl -l
$ ./${GOPATH}/bin/gotunl -c 1
```