antony@notes:~/misc$ cat "etc-profile.md"
/etc/profile
/etc/profile
$ cat /etc/profile
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export PAGER=less
export PS1='\h:\w\$ '
umask 022
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
# Alpine 的啟動系統是 openrc, 登入前會執行 /etc/local.d/rc.local.start, 登入後會執行 /etc/profile
gw=$(route -n | grep -e "^0.0.0.0 ")
export GWIF=${gw##* }
ips=$(ifconfig $GWIF | grep 'inet ')
export IP=$(echo $ips | cut -d' ' -f2 | cut -d':' -f2)
export NETID=${IP%.*}
export GW=$(route -n | grep -e '^0.0.0.0' | tr -s \ - | cut -d ' ' -f2)
export PATH="/home/bigred/bin:/home/bigred/vmalpdt/bin:$PATH"
# source /home/bigred/bin/myk3s
clear && sleep 2
echo "Welcome to Alpine Linux : `cat /etc/alpine-release`"
[ "$IP" != "" ] && echo "IP : $IP"
echo ""
if [ "$USER" == "bigred" ]; then
# change hostname & set IP
sudo /home/bigred/bin/chnameip
# create join k3s command
#which kubectl &>/dev/null
#if [ "$?" == "0" ]; then
# if [ -z "$SSH_TTY" ]; then
# echo "K3S Starting, pls wait 30 sec" && sleep 30
# kubectl get nodes 2>/dev/null | grep master | grep `hostname` &>/dev/null
# if [ "$?" == "0" ]; then
# echo "sudo curl -sfL https://get.k3s.io | K3S_URL=https://$IP:6443 K3S_TOKEN=`sudo cat /var/lib/rancher/k3s/server/node-token` K3S_KUBECONFIG_MODE='644' sh - && sudo reboot" > /home/bigred/bin/joink3s
# chmod +x /home/bigred/bin/joink3s
# fi
# fi
#fi
fi
export PS1="\u@\h:\w\$ "
alias ping='ping -c 4 '
alias pingdup='sudo arping -D -I eth0 -c 2 '
alias dir='ls -alh '
alias poweroff='sudo poweroff; sleep 5'
alias reboot='sudo reboot; sleep 5'
alias kg='kubectl get'
alias ka='kubectl apply'
alias kd='kubectl delete'
alias kc='kubectl create'
alias ks='kubectl get pods -n kube-system'
[ -f /home/bigred/dt/alpine.bash ] && source /home/bigred/dt/alpine.bash
# /etc/local.d/rc.local.start (相當於 rc.local) create /tmp/sinfo
if [ -z "$SSH_TTY" ]; then
[ -f /tmp/sinfo ] && dialog --title " Cloud Native Trainer " --textbox /tmp/sinfo 24 85; clear
fi