Last active
September 23, 2021 01:46
-
-
Save sakkke/86ba1aaebe7ede29828adb65b70ddb80 to your computer and use it in GitHub Desktop.
Setup script for 2021-05-07-raspios-buster-arm64-lite.img
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# raspberrypi login: pi | |
# Password: raspberry | |
# Time zone: Asia/Tokyo | |
# Keyboard layout: jp | |
function setup1 { | |
sudo raspi-config nonint do_change_locale ja_JP.UTF-8 | |
sudo raspi-config nonint do_boot_behaviour B2 | |
echo Hint: setup_2 adds GUI. | |
echo Info: Require reboot to apply new changes. Please run reboot command. | |
} | |
function setup2 { | |
# Initialize packages | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get autoremove -y | |
# Disable screen blanking | |
echo 'xset -dpms' >> ~/.xinitrc | |
echo 'xset s noblank' >> ~/.xinitrc | |
echo 'xset s off' >> ~/.xinitrc | |
# Install fcitx-mozc | |
sudo apt-get install -y fcitx-mozc | |
echo -e 'export GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx\nfcitx &' >> ~/.xinitrc | |
# Configure for HiDPI | |
echo 'export GTK_SCALE=2' >> ~/.xinitrc # for GTK | |
echo 'export QT_SCALE_FACTOR=2' >> ~/.xinitrc # for Qt | |
# Pre-install i3-wm | |
sudo mkdir -pv /usr/local/share/backgrounds | |
curl -s 'https://images.pexels.com/photos/2138922/pexels-photo-2138922.jpeg?crop=entropy&cs=srgb&dl=pexels-kyle-roxas-2138922.jpg&fit=crop&fm=jpg&h=2160&w=3840' | | |
sudo tee /usr/local/share/backgrounds/wallpaper.jpg > /dev/null | |
sudo apt-get install -y feh | |
echo 'if [ -x ~/.fehbg ]; then ~/.fehbg; else feh --bg-scale /usr/local/share/backgrounds/wallpaper.jpg; fi' >> ~/.xinitrc | |
# Install i3-wm | |
sudo apt-get install -y i3-wm i3status suckless-tools xinit | |
echo 'Xft.dpi: 192' >> ~/.Xdefaults # Hint: `xdpyinfo | grep resolution` | |
echo 'exec i3' >> ~/.xinitrc | |
echo 'if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]; then startx; fi' >> ~/.bashrc | |
# Install PlemolJP | |
wget https://github.com/yuru7/PlemolJP/releases/download/v0.3.0/PlemolJP_NF_v0.3.0.zip | |
unzip PlemolJP_NF_v0.3.0.zip | |
pushd PlemolJP_NF_v0.3.0/PlemolJPConsole_NF | |
sudo cp -v *.ttf /usr/local/share/fonts | |
fc-cache -v /usr/local/share/fonts | |
popd | |
rm -frv PlemolJP_NF_v0.3.0 | |
rm -v PlemolJP_NF_v0.3.0.zip | |
# Install st | |
wget http://zzo38computer.org/prog/farbfeld.zip | |
echo -e 'ff-blur.c\nff-border.c\nff-bright.c' | xargs -I% sh -c 'unzip -p farbfeld.zip % > % && gcc -o $(basename % .c) % -lm' | |
sudo apt-get install -y farbfeld git | |
jpg2ff < /usr/local/share/backgrounds/wallpaper.jpg | ./ff-border e 50 | ./ff-bright rgba 0 0.5 1 | ./ff-blur 50 15 | | |
sudo tee /usr/local/share/backgrounds/wallpaper.ff > /dev/null | |
rm -v farbfeld.zip ff-blur ff-blur.c ff-border ff-border.c ff-bright ff-bright.c | |
git clone git://git.suckless.org/st -b 0.8.4 --depth 1 | |
pushd st | |
patch -i <(curl -s https://st.suckless.org/patches/background_image/st-background-image-0.8.4.diff) | |
patch -i <(curl -s https://st.suckless.org/patches/nordtheme/st-nordtheme-0.8.2.diff) | |
rm -v config.def.h.orig | |
cp -v config.def.h config.h | |
sed -i 's%Liberation Mono:pixelsize=12%PlemolJP Console NF:size=16%' config.h | |
sed -i 's:/path/to/image.ff:/usr/local/share/backgrounds/wallpaper.ff:' config.h | |
sed -i 's:\(pseudotransparency\) = 0:\1 = 1:' config.h | |
sudo apt-get install -y libx11-dev libxft-dev | |
make | |
sudo make install | |
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/st 200 | |
popd | |
rm -frv st | |
# Install additional fonts | |
sudo apt-get install -y fonts-noto | |
echo Info: Require relogin to enter new environment. Please run exit command. | |
} | |
function setup3 { | |
# Configure fcitx-mozc | |
sed -i 's/\(IMName\)=fcitx-keyboard-us/\1=mozc/' ~/.config/fcitx/profile | |
sed -i 's/\(fcitx-keyboard-us\):True/\1:False/' ~/.config/fcitx/profile | |
echo Hint: setup_4 personalizes environment. | |
echo Info: Require reboot to apply new changes. Please run reboot command. | |
} | |
function setup4 { | |
# Install tmux | |
sudo apt-get install -y tmux | |
# Install neovim | |
git clone git://github.com/neovim/neovim.git -b v0.5.0 --depth 1 | |
pushd neovim | |
sudo apt-get install -y ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl | |
make CMAKE_BUILD_TYPE=Release | |
sudo make CMAKE_INSTALL_PREFIX=/usr/local install | |
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 200 | |
popd | |
rm -frv neovim | |
# Configure i3-wm | |
echo 'exec i3-sensible-terminal' >> ~/.config/i3/config | |
# Install firefox-esr | |
sudo apt-get install -y firefox-esr firefox-esr-l10n-ja | |
# Install simplescreenrecorder | |
# sudo apt-get install -y simplescreenrecorder | |
# Install screencast | |
git clone https://github.com/dbermond/screencast.git -b v1.6.0 --depth 1 | |
pushd screencast | |
sed -i '68 { s/"\($1\)"/\1/ }' src/screen.sh | |
make | |
sudo make install | |
sudo apt-get install -y slop | |
popd | |
rm -frv screencast | |
# Install moc | |
sudo apt-get install -y moc pulseaudio | |
# Install vlc | |
sudo apt-get install -y vlc | |
# Install zsh | |
sudo apt-get install -y zsh | |
# dotfiles | |
git clone https://github.com/sakkke/dotfiles.git ~/.dotfiles | |
~/.dotfiles/install | |
echo 'if [ -z $DISPLAY ] && [ $(tty) = /dev/tty1 ]; then startx; fi' >> ~/.zshrc | |
echo 'Info: Is audio not working? In this case, please run `sudo raspi-config nonint do_audio 1` etc.' | |
echo 'Info: To change default shell, please run `chsh -s /usr/bin/zsh`. setup5 requires zsh as default shell.' | |
echo Info: Require reboot to enter new environment. Please run reboot command. | |
} | |
function setup5 { | |
sudo apt-get install -y ripgrep xclip # for nvim | |
# Install nodejs | |
asdf plugin add nodejs | |
asdf install nodejs 14.17.6 | |
asdf global nodejs 14.17.6 | |
# Install yarn | |
asdf plugin add yarn | |
asdf install yarn 1.22.11 | |
asdf global yarn 1.22.11 | |
yarn global add neovim # for nvim | |
# Install python | |
asdf plugin add python | |
sudo apt-get install -y libbz2-dev libreadline-dev libsqlite3-dev libssl-dev | |
asdf install python 3.6.15 | |
asdf global python 3.6.15 | |
pip install pynvim # for nvim | |
pip install sympy | |
echo Info: All setup is complete. Have fun! | |
echo Info: Require reboot to apply new changes. Please run reboot command. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage