This commit is contained in:
2025-11-01 21:18:29 +08:00
parent 35478d43d6
commit a607719b46
119 changed files with 815 additions and 1221 deletions

View File

@@ -12,8 +12,10 @@ trap Quit EXIT
PIDS=
GOT_SIGTERM=
LOG_DIR='/var/log/cloudreve'
DATA_DIR='/var/lib/cloudreve'
LOG_DIR=/var/log/cloudreve
DATA_DIR=/var/lib/cloudreve
SOCK_FILE=/sock/cloudreve
CONF_FILE=$DATA_DIR/cloudreve.ini
function Print {
local file=/dev/null
@@ -32,9 +34,8 @@ function Quit {
}
function ModifyConf {
[ -e $DATA_DIR/cloudreve.ini ] && return 0
Print Generating cloudreve.ini ...
cat > $DATA_DIR/cloudreve.ini <<-EOF
Print Generating $CONF_FILE ...
cat > $CONF_FILE <<-EOF
[System]
Debug = false
Mode = master
@@ -43,7 +44,8 @@ SessionSecret = $(date +%F | sha256sum | cut -c -64)
HashIDSalt = $(date +%T | sha256sum | cut -c -64)
#[UnixSocket]
#Listen = /socket/cloudreve
#Listen = $SOCK_FILE
#Perm = 0666
[Database]
DBFile = $DATA_DIR/cloudreve.db
@@ -71,15 +73,17 @@ EOF
function StartProc {
Print Starting cloudreve ...
rm -f /socket/cloudreve
/opt/cloudreve -c $DATA_DIR/cloudreve.ini &>> $LOG_DIR/cloudreve.out &
cd $DATA_DIR
/opt/cloudreve -c cloudreve.ini &>> $LOG_DIR/cloudreve.out &
PIDS="$PIDS $!"
sleep 8
[ -e $SOCK_FILE ] && chmod 0666 $SOCK_FILE
Print Cloudreve started.
}
function Main {
local pid=
ModifyConf
[ -e $CONF_FILE ] || ModifyConf
StartProc
trap "GOT_SIGTERM=1; Print Got SIGTERM ..." SIGTERM
while [ -z "$GOT_SIGTERM" ] && sleep 2; do

View File

@@ -2,7 +2,7 @@ version: "3.7"
services:
rsync:
image: harbor.colben.cn/general/cloudreve
image: harbor.boyachain.cn:20443/general/cloudreve
container_name: cloudreve
restart: "on-failure"
stop_grace_period: 1m

View File

@@ -2,6 +2,7 @@ ARG ARCH
FROM harbor.colben.cn/general/photon$ARCH:4
MAINTAINER Colben colbenlee@gmail.com
ADD --chown=root:root /ADD/ /opt/
RUN mkdir -p /var/{log,lib}/cloudreve
RUN mkdir -p /var/{log,lib}/cloudreve /sock
ENV GIN_MODE=release
CMD ["/opt/ccmd"]

View File

@@ -43,13 +43,6 @@ function YesOrNo {
function Update {
Warn Preparing cloudreve ...
cd $ROOT_DIR/ADD
if [ -z "$ARCH" ]; then
tar zxf $(ls /release/RUNTIME/cloudreve_*_linux_amd64.tar.gz|tail -1)
elif [ 'aarch64' == "$ARCH" ]; then
tar zxf $(ls /release/RUNTIME/cloudreve_*_linux_arm64.tar.gz|tail -1)
else
Error Not supported arch: $ARCH!
fi
chmod 0755 cloudreve
}