Initial commit
This commit is contained in:
51
rootfs/entrypoint.sh
Executable file
51
rootfs/entrypoint.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
: ${NTP_SERVER:="pool.ntp.org"}
|
||||
: ${SYNC_RTC:="true"}
|
||||
: ${ALLOW_CIDR:=""}
|
||||
|
||||
CONFIG=${CONFIG:-"/etc/chrony/chrony.conf"}
|
||||
|
||||
cat << EOF > "${CONFIG}"
|
||||
pool ${NTP_SERVER} iburst
|
||||
initstepslew 10 ${NTP_SERVER}
|
||||
driftfile /var/lib/chrony/chrony.drift
|
||||
cmdport 0
|
||||
EOF
|
||||
|
||||
[ "${SYNC_RTC}" = "true" ] && echo "rtcsync" >> "${CONFIG}"
|
||||
[ "${ALLOW_CIDR}" != "" ] && echo "allow ${ALLOW_CIDR}" >> "${CONFIG}"
|
||||
|
||||
# fix permission
|
||||
chown chrony:chrony -R /var/lib/chrony /etc/chrony/chrony.conf
|
||||
# remove previous pid file if it exist
|
||||
[ -e /var/run/chrony/chronyd.pid ] && rm /var/run/chrony/chronyd.pid
|
||||
|
||||
function custom_bashrc {
|
||||
echo '
|
||||
export LS_OPTIONS="--color=auto"
|
||||
alias "ls=ls $LS_OPTIONS"
|
||||
alias "ll=ls $LS_OPTIONS -la"
|
||||
alias "l=ls $LS_OPTIONS -lA"
|
||||
'
|
||||
}
|
||||
|
||||
function set_bashrc {
|
||||
echo "-----------------------------------------"
|
||||
echo " .bashrc file setup..."
|
||||
echo "-----------------------------------------"
|
||||
custom_bashrc | tee /root/.bashrc
|
||||
echo 'export PS1="\[\e[35m\][\[\e[31m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]# "' >> /root/.bashrc
|
||||
for i in $(ls /home); do echo 'export PS1="\[\e[35m\][\[\e[33m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]$ "' >> /home/${i}/.bashrc; done
|
||||
}
|
||||
|
||||
set_bashrc
|
||||
|
||||
CMD="$@"
|
||||
[ -z "$CMD" ] && export CMD="supervisord -c /etc/supervisor/supervisord.conf"
|
||||
|
||||
exec $CMD
|
||||
|
||||
exit $?
|
||||
Reference in New Issue
Block a user