-
Notifications
You must be signed in to change notification settings - Fork 2
/
user_commands.bash.example
134 lines (107 loc) · 2.93 KB
/
user_commands.bash.example
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
#!/bin/bash
#
# Example of a file
# user_commands.bash
# that can be used for customizing the EndeavourOS install.
#
# How to use this file:
# 1) Edit this file to your liking.
# 2) Copy it under the /home/liveuser/ folder before starting the install process.
#
# Date added: 2021-Nov-28
# Last modified: -
#
Msg() {
local severity="$1"
local msg="$2"
echo "==> user_commands.bash: $severity: $msg"
}
GetNewUserName() {
# This function is required when customizing personal settings.
if [ -r /tmp/new_username.txt ] ; then
new_user="$(cat /tmp/new_username.txt)"
if [ -n "$new_user" ] ; then
home="/home/$new_user"
fi
fi
}
BashrcConfig() {
Msg info "add settings to $home/.bashrc."
cat <<EOF >> $home/.bashrc
alias l='ls -la --ignore=.?*'
alias ll='ls -la --ignore=..'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias ln='ln -i'
alias nano='nano -l'
alias pacdiff=eos-pacdiff
alias poweroff='sync; poweroff'
alias reboot='sync; reboot'
alias update-grub='grub-mkconfig -o /boot/grub/grub.cfg'
alias df='df -hT'
alias md='code-oss -n' # Visual Studio Code as a markdown editor
alias grep='grep -n'
bind '"\e[A":history-search-backward' # history with arrow up key
bind '"\e[B":history-search-forward' # history with arrow down key
bind 'set show-all-if-ambiguous on' # complete with single TAB
bind 'set mark-symlinked-directories on' # complete directory symlinks with slash
export LESS="-RFn"
PS1='\w> '
EOF
# Make sure file owner is correct
# (not really needed if the file already exists).
chown $new_user:$new_user $home/.bashrc
}
HomeSettings() {
# Here you can add here some user specific stuff.
local new_user=""
local home=""
GetNewUserName # sets values for variables new_user and home
# Validity checks.
if [ -z "$new_user" ] ; then
Msg warning "user name could not be found!"
return
fi
if [ ! -d "$home" ] ; then
Msg warning "user's home folder does not exist!"
return
fi
BashrcConfig # adds settings into ~/.bashrc
}
ManagePackages() {
# Install and uninstall packages
local Install=( # packages to install
atril
code
emacs
gparted
gufw
llpp # fast PDF reader for complex PDF files
mpv
ncdu
simple-scan
solaar # for wireless Logitech mice and keyboards
terminator
)
local Remove=( # packages to remove
glances
s-tui
parole
capitaine-cursors
file-roller
)
pacman -Rsn --noconfirm "${Remove[@]}"
pacman -Syu --noconfirm --needed "${Install[@]}"
sleep 1 # wait a bit after installing packages
}
ManageServices() {
# enable the ufw firewall service (ufw comes with gufw)
systemctl enable ufw
}
Main() {
ManagePackages
ManageServices
HomeSettings
}
Main