Initial commit
This commit is contained in:
79
rootfs/entrypoint.sh
Executable file
79
rootfs/entrypoint.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
: ${path_list:="
|
||||
/path/foo
|
||||
"}
|
||||
|
||||
function _dirs {
|
||||
DEST_PATH="/data"
|
||||
|
||||
echo "--------------------------------------"
|
||||
echo " Moving persistent data in $DEST_PATH "
|
||||
echo "--------------------------------------"
|
||||
|
||||
for path_name in $path_list; do
|
||||
if [ ! -e ${DEST_PATH}${path_name} ]; then
|
||||
if [ -d $path_name ]; then
|
||||
rsync -Ra ${path_name}/ ${DEST_PATH}/
|
||||
else
|
||||
rsync -Ra ${path_name} ${DEST_PATH}/
|
||||
fi
|
||||
else
|
||||
echo "---------------------------------------------------------"
|
||||
echo " No NEED to move anything for $path_name in ${DEST_PATH} "
|
||||
echo "---------------------------------------------------------"
|
||||
fi
|
||||
rm -rf ${path_name}
|
||||
ln -s ${DEST_PATH}${path_name} ${path_name}
|
||||
done
|
||||
}
|
||||
|
||||
function _main {
|
||||
[ -e "/data/dhcpd4.conf" ] || cp "/template/dhcpd4.conf" "/data/"
|
||||
[ -e "/data/dhcpd6.conf" ] || cp "/template/dhcpd6.conf" "/data/"
|
||||
[ -e "/data/dhcpd4.leases" ] || touch "/data/dhcpd4.leases"
|
||||
[ -e "/data/dhcpd6.leases" ] || touch "/data/dhcpd6.leases"
|
||||
useradd dhcpd
|
||||
uid=$(id -u dhcpd)
|
||||
gid=$(id -g dhcpd)
|
||||
chown -R dhcpd: "/data/dhcpd4.leases" "/data/dhcpd6.leases"
|
||||
|
||||
export CMDv4="/usr/sbin/dhcpd -4 -f -d --no-pid -cf /data/dhcpd4.conf -lf /data/dhcpd4.leases -user dhcpd -group dhcpd"
|
||||
export CMDv6="/usr/sbin/dhcpd -6 -f -d --no-pid -cf /data/dhcpd6.conf -lf /data/dhcpd6.leases -user dhcpd -group dhcpd"
|
||||
|
||||
[ "$DHCP4" = "1" ] && export CMD=$CMDv4
|
||||
if [ "$DHCP6" = "1" ]; then
|
||||
[ -z "$CMD" ] && export CMD=$CMDv6 || $CMDv6 &
|
||||
fi
|
||||
chown -R dhcpd: "/data"
|
||||
}
|
||||
|
||||
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 _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
|
||||
}
|
||||
|
||||
#_dirs
|
||||
_main
|
||||
_bashrc
|
||||
|
||||
#CMD="$@"
|
||||
[ -z "$CMD" ] && export CMD="supervisord -c /etc/supervisor/supervisord.conf"
|
||||
|
||||
exec $CMD
|
||||
|
||||
exit $?
|
||||
44
rootfs/template/dhcpd4.conf
Normal file
44
rootfs/template/dhcpd4.conf
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
# 3600 = 1 hour
|
||||
# 86400 = 1 day
|
||||
# 604800 = 1 week
|
||||
# 2419200 = 1 month
|
||||
|
||||
default-lease-time 604800;
|
||||
max-lease-time 2419200;
|
||||
log-facility local7;
|
||||
|
||||
## assign 10.10.10.x/24 address (ex 10.10.10.1) to the interface from which you want to propagate the dhcp.
|
||||
subnet 10.10.10.0 netmask 255.255.255.0 {
|
||||
|
||||
## dhcp inclusion range
|
||||
range 10.10.10.50 10.10.10.200;
|
||||
|
||||
ddns-domainname "domain.com";
|
||||
option domain-name "domain.com";
|
||||
option subnet-mask 255.255.255.0;
|
||||
option broadcast-address 10.10.10.255;
|
||||
option routers 10.10.10.145;
|
||||
option domain-name-servers 10.10.10.131, 10.10.10.132;
|
||||
option ntp-servers ntp;
|
||||
option smtp-server mail;
|
||||
# option time-offset -10000;
|
||||
# option netbios-name-servers 192.168.111.5;
|
||||
# default-lease-time 604800;
|
||||
# max-lease-time 2419200;
|
||||
# deny unknown-clients;
|
||||
deny bootp;
|
||||
deny duplicates;
|
||||
deny declines;
|
||||
|
||||
## reservation
|
||||
#host dsk01 {hardware ethernet bc:24:11:cf:a4:86; fixed-address 10.10.10.129;}
|
||||
#host dsk02 {hardware ethernet dc:a6:32:d5:f3:f4; fixed-address 10.10.10.133;}
|
||||
|
||||
## deny from dhcp
|
||||
class "ignored" {match substring (hardware, 1, 6); ignore booting;}
|
||||
# subclass "ignored" 18:45:91:c3:d9:00;
|
||||
# subclass "ignored" 18:45:91:c3:d9:00;
|
||||
|
||||
}
|
||||
|
||||
44
rootfs/template/dhcpd6.conf
Normal file
44
rootfs/template/dhcpd6.conf
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
# 3600 = 1 hour
|
||||
# 86400 = 1 day
|
||||
# 604800 = 1 week
|
||||
# 2419200 = 1 month
|
||||
|
||||
default-lease-time 2592000;
|
||||
preferred-lifetime 604800;
|
||||
option dhcp-renewal-time 3600;
|
||||
|
||||
option dhcp-rebinding-time 7200;
|
||||
allow leasequery;
|
||||
|
||||
option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
|
||||
option dhcp6.domain-search "test.example.com","example.com";
|
||||
|
||||
option dhcp6.info-refresh-time 21600;
|
||||
|
||||
# Static definition (must be global)
|
||||
#host myclient {
|
||||
# dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;
|
||||
#
|
||||
# fixed-address6 3ffe:501:ffff:100::1234;
|
||||
# fixed-prefix6 3ffe:501:ffff:101::/64;
|
||||
#
|
||||
# # Override of the global definitions,
|
||||
# option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:4f4e;
|
||||
#}
|
||||
|
||||
|
||||
#host otherclient {
|
||||
# hardware ethernet 01:00:80:a2:55:67;
|
||||
# fixed-address6 3ffe:501:ffff:100::4321;
|
||||
#}
|
||||
|
||||
#subnet6 3ffe:501:ffff:100::/64 {
|
||||
# range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;
|
||||
#}
|
||||
|
||||
#subnet6 3ffe:501:ffff:102::/64 {
|
||||
# range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;
|
||||
#}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user