blob: ea1e7d2576661cc4e1e97bf0daef16f0df9ae13b (
plain)
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
|
#!/bin/sh
if [ $(id -u) -ne 0 ] ; then
echo 'this script should be run as root instead!'
exit 1
fi
USER_NAME='loek'
HOST_NAME='drvo'
KERNEL_VERSION='6.6.15-ti-rt-arm32-r1' # latest i could find for ti
# fail ok
fok() { "$@" 1> /dev/null 2> /dev/null ; }
echo "setting hostname to $HOST_NAME..."
hostname $HOST_NAME
hostname > /etc/hostname
sed -i 's/\<BeagleBone\>/'"$HOST_NAME"'/g' /etc/hosts
echo "creating user $USER_NAME..."
fok userdel debian
rm -rf /home/debian
fok id -u $USER_NAME || fok adduser $USER_NAME
echo "removing all security..."
rm -f /etc/sudoers.d/admin
cat << "EOF" > /etc/sudoers.d/nopasswd
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
EOF
usermod -aG sudo $USER_NAME
cat << "EOF" > /etc/ssh/sshd_config.d/rice.conf
PasswordAuthentication yes
PermitEmptyPasswords yes
PermitRootLogin yes
PrintLastLog no
EOF
systemctl restart ssh
fok passwd -d root
fok passwd -d $USER_NAME
echo "fixing terminal colors & default editor..."
cat << "EOF" > /etc/profile.d/rice.sh
export TERM="xterm-256color"
export EDITOR="nvim"
EOF
echo "removing bloatware..."
fok apt remove -y --allow-change-held-packages \
libruby2.7 libgl1-mesa-dri python3-numpy mesa-vulkan-drivers \
bb-beagle-config libflite1 firmware-libertas python3-mypy libgtk-3-common \
adwaita-icon-theme firmware-atheros firmware-misc-nonfree \
pocketsphinx-en-us scratch libwebkit2gtk-4.0-37 firmware-iwlwifi \
bb-node-red-installer firefox-esr bb-code-server plymouth xserver-xorg-core \
xserver-xorg xserver-xorg-legacy x11-common x11-server-utils x11-utils \
lightdm-gtk-greeter lightdm xfce4-session xfce4-panel xfce4-settings \
xfce4-helpers fonts-dejavu-core nodejs nodejs-doc nginx-core nginx-common \
nginx mesa-va-drivers bluetooth bluez pipewire-bin pipewire pulseaudio-utils \
pulseaudio gtk-update-icon-cache wpasupplicant fontconfig-config fontconfig \
hostapd adwaita-icon-theme hicolor-icon-theme polkitd whiptail
echo "removing more bloatware..."
fok apt autoremove -y
echo "cleaning up trash..."
fok apt clean -y
echo "updating system..."
fok apt-get update
fok apt-get upgrade -y
echo "preparing for debian sid update..."
export DEBIAN_FRONTEND=noninteractive
echo "usrmerge usrmerge/autoconvert boolean true" | debconf-set-selections
fok apt-get install usrmerge -y
cat << "EOF" > /etc/apt/sources.list
deb http://deb.debian.org/debian sid main contrib non-free
deb [arch=armhf signed-by=/usr/share/keyrings/rcn-ee-archive-keyring.gpg] http://repos.rcn-ee.com/debian/ sid main
EOF
fok apt-get update
echo "updating to debian sid..."
apt-get dist-upgrade -y
echo "removing noisy banners..."
rm -f /etc/motd /etc/issue /etc/issue.net /etc/dogtag
echo "install newer linux kernel..."
fok apt-get install -y linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION
echo "install based software..."
fok apt-get install -y neovim zsh git systemd-resolved
fok chsh -s /bin/zsh $USER_NAME
fok chsh -s /bin/zsh root
cp /etc/zsh/newuser.zshrc.recommended "/home/$USER_NAME/.zshrc"
chown "$USER_NAME:$USER_NAME" "/home/$USER_NAME/.zshrc"
cat << "EOF" > /root/.zshrc
# Set up the prompt
autoload -Uz promptinit
promptinit
prompt redhat
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
EOF
echo "emulate sh -c 'source /etc/profile'" >> /etc/zsh/zprofile
echo "cleaning up trash..."
fok apt clean -y
echo "all done!"
|