-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
62 lines (46 loc) · 1.46 KB
/
entrypoint.sh
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
#!/bin/sh
# LABEL name="ye3tftp" version="1.0.0" author="palw3ey" maintainer="palw3ey" email="[email protected]" website="https://github.com/palw3ey/ye3tftp" license="MIT" create="20231202" update="20240115"
# Entrypoint for docker
# ============ [ global variable ] ============
vg_name=ye3tftp
vg_chmod_option=""
vg_create_option=""
# ============ [ function ] ============
# echo information for docker logs
function f_log(){
echo -e "$(date '+%Y-%m-%d %H:%M:%S') $(hostname) $vg_name: $@"
}
# ============ [ internationalisation ] ============
if [[ -f /i18n/$Y_LANGUAGE.sh ]]; then
f_log "i18n $Y_LANGUAGE"
source /i18n/$Y_LANGUAGE.sh
else
f_log "i18n fr_FR"
source /i18n/fr_FR.sh
fi
# ============ [ config ] ============
# apply chmod if specified
if [[ ! -z "$Y_CHMOD" ]]; then
f_log "$i_apply chmod"
if [[ $Y_CHMOD_RECURSIVE == "yes" ]]; then
f_log "$i_recursive"
vg_chmod_option="-R"
fi
chmod $Y_CHMOD $vg_chmod_option /data/*
fi
# check if create is enabled
if [[ $Y_CREATE == "yes" ]]; then
f_log "$i_enable create"
vg_create_option="--create"
fi
# ============ [ start service ] ============
f_log "$i_start in.tftpd"
if [[ $Y_DEBUG == "yes" ]]; then
f_log "$i_with_debug_option"
/usr/sbin/in.tftpd --foreground --secure $vg_create_option --address $Y_IP:$Y_PORT --verbosity 4 /data &
else
/usr/sbin/in.tftpd --foreground --secure $vg_create_option --address $Y_IP:$Y_PORT /data &
fi
f_log ":: $i_ready ::"
# keep the server running
tail -f /dev/null