Add SeaweedFS Alpine package build
This commit is contained in:
86
packaging/alpine/local/seaweedfs/openrc/seaweedfs.initd
Normal file
86
packaging/alpine/local/seaweedfs/openrc/seaweedfs.initd
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
service_name="${RC_SVCNAME#seaweedfs.}"
|
||||
description="SeaweedFS ${service_name} service"
|
||||
|
||||
command="/usr/bin/weed"
|
||||
command_user="${SEAWEEDFS_USER:-seaweedfs}:${SEAWEEDFS_GROUP:-seaweedfs}"
|
||||
command_background="yes"
|
||||
pidfile="/run/seaweedfs/${RC_SVCNAME}.pid"
|
||||
output_log="${SEAWEEDFS_LOG:-/var/log/seaweedfs/${RC_SVCNAME}.log}"
|
||||
error_log="${SEAWEEDFS_ERRLOG:-/var/log/seaweedfs/${RC_SVCNAME}.log}"
|
||||
|
||||
build_command_args() {
|
||||
command_args="$service_name"
|
||||
data_dir=""
|
||||
cache_dir=""
|
||||
|
||||
case "$service_name" in
|
||||
admin)
|
||||
data_dir="${SEAWEEDFS_DATA_DIR:-/var/lib/seaweedfs/admin}"
|
||||
command_args="$command_args -master=${SEAWEEDFS_MASTER:-localhost:9333} -dataDir=${data_dir}"
|
||||
;;
|
||||
filer)
|
||||
data_dir="${SEAWEEDFS_DATA_DIR:-/var/lib/seaweedfs/filer}"
|
||||
command_args="$command_args -master=${SEAWEEDFS_MASTER:-localhost:9333} -defaultStoreDir=${data_dir}"
|
||||
;;
|
||||
master)
|
||||
data_dir="${SEAWEEDFS_DATA_DIR:-/var/lib/seaweedfs/master}"
|
||||
command_args="$command_args -mdir=${data_dir} -peers=${SEAWEEDFS_PEERS:-none}"
|
||||
;;
|
||||
s3)
|
||||
command_args="$command_args -filer=${SEAWEEDFS_FILER:-localhost:8888}"
|
||||
;;
|
||||
sftp)
|
||||
command_args="$command_args -filer=${SEAWEEDFS_FILER:-localhost:8888}"
|
||||
;;
|
||||
volume)
|
||||
data_dir="${SEAWEEDFS_DATA_DIR:-/var/lib/seaweedfs/volume}"
|
||||
command_args="$command_args -dir=${data_dir} -max=${SEAWEEDFS_VOLUME_MAX:-0} -master=${SEAWEEDFS_MASTER:-localhost:9333}"
|
||||
;;
|
||||
webdav)
|
||||
cache_dir="${SEAWEEDFS_CACHE_DIR:-/var/cache/seaweedfs/webdav}"
|
||||
command_args="$command_args -filer=${SEAWEEDFS_FILER:-localhost:8888} -cacheDir=${cache_dir}"
|
||||
;;
|
||||
worker)
|
||||
data_dir="${SEAWEEDFS_DATA_DIR:-/var/lib/seaweedfs/worker}"
|
||||
command_args="$command_args -admin=${SEAWEEDFS_ADMIN:-localhost:23646} -workingDir=${data_dir}"
|
||||
;;
|
||||
esac
|
||||
|
||||
command_args="$command_args ${SEAWEEDFS_OPTS:-}"
|
||||
}
|
||||
|
||||
build_command_args
|
||||
|
||||
depend() {
|
||||
need net
|
||||
case "$service_name" in
|
||||
volume|filer|admin)
|
||||
after seaweedfs.master
|
||||
;;
|
||||
s3|webdav|sftp)
|
||||
after seaweedfs.filer
|
||||
;;
|
||||
worker)
|
||||
after seaweedfs.admin
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -m 0755 -o "${SEAWEEDFS_USER:-seaweedfs}:${SEAWEEDFS_GROUP:-seaweedfs}" \
|
||||
/run/seaweedfs \
|
||||
/var/log/seaweedfs \
|
||||
/var/lib/seaweedfs
|
||||
|
||||
if [ -n "$data_dir" ]; then
|
||||
checkpath -d -m 0750 -o "${SEAWEEDFS_USER:-seaweedfs}:${SEAWEEDFS_GROUP:-seaweedfs}" \
|
||||
"$data_dir"
|
||||
fi
|
||||
|
||||
if [ -n "$cache_dir" ]; then
|
||||
checkpath -d -m 0750 -o "${SEAWEEDFS_USER:-seaweedfs}:${SEAWEEDFS_GROUP:-seaweedfs}" \
|
||||
"$cache_dir"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user