mirror of https://github.com/OpenIPC/firmware.git
56 lines
1.5 KiB
Bash
56 lines
1.5 KiB
Bash
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/tmp"
|
|
export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
|
|
export HOME=${HOME:-/root}
|
|
export TZ=$(cat /etc/TZ)
|
|
export SENSOR=$(fw_printenv -n sensor)
|
|
|
|
echo_c() { echo -ne "\e[1;$1m$2\e[0m"; }
|
|
|
|
if [ "$PS1" ]; then
|
|
[ -f /etc/os-release ] && . /etc/os-release
|
|
[ -f /etc/openipc_banner ] && echo_c 34 "$(cat /etc/openipc_banner)"
|
|
echo_c 32 "$(printf "%56s" "${GITHUB_VERSION}")"
|
|
[ -f /etc/openipc_donors ] && echo_c 37 "\n\n$(cat /etc/openipc_donors)\n\n"
|
|
#
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
export PS1='\u@\h:\w\# '
|
|
else
|
|
export PS1='\u@\h:\w\$ '
|
|
fi
|
|
fi
|
|
|
|
export EDITOR='/bin/vi'
|
|
|
|
[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
|
|
|
|
differ() {
|
|
diff -rN "/rom$1" "$1"
|
|
}
|
|
|
|
majestic_changes() {
|
|
diff -L "Majestic changes" -U 3 /rom/etc/majestic.yaml /etc/majestic.yaml
|
|
}
|
|
|
|
show_modules() {
|
|
echo; cat /proc/modules | cut -f 1 -d " " | while read module; do echo "Module: $module"; \
|
|
if [ -d "/sys/module/$module/parameters" ]; then ls /sys/module/$module/parameters/ | while read parameter; \
|
|
do echo -n "Parameter: $parameter --> "; cat /sys/module/$module/parameters/$parameter; done; fi; echo; done
|
|
}
|
|
|
|
show_fullname() {
|
|
echo "openipc-$(ipcinfo --chip-name)-$(ipcinfo --short-sensor)"
|
|
}
|
|
|
|
set_fullname() {
|
|
show_fullname >/etc/hostname
|
|
}
|
|
|
|
show_wlan() {
|
|
grep -r '$1..=' /etc/wireless | cut -d '"' -f 4 | sort | grep -e $(fw_printenv -n soc) -e generic
|
|
}
|
|
|
|
# Source configuration files from /etc/profile.d
|
|
for i in /etc/profile.d/*.sh; do
|
|
[ -r "$i" ] && . $i
|
|
done; unset i
|