commit ec2d1585afcb03e26296658bf7eb8e9665695d86 Author: Krcia <1503175889@qq.com> Date: Wed Dec 3 09:24:05 2025 +0800 初始化项目 diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/certimate.iml b/.idea/certimate.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/certimate.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..deac60d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ICON.PNG b/ICON.PNG new file mode 100644 index 0000000..4c85b2b Binary files /dev/null and b/ICON.PNG differ diff --git a/ICON_256.PNG b/ICON_256.PNG new file mode 100644 index 0000000..b30c921 Binary files /dev/null and b/ICON_256.PNG differ diff --git a/app/bin/certimate b/app/bin/certimate new file mode 100644 index 0000000..79ea7c1 Binary files /dev/null and b/app/bin/certimate differ diff --git a/app/ui/config b/app/ui/config new file mode 100644 index 0000000..c54d82e --- /dev/null +++ b/app/ui/config @@ -0,0 +1,13 @@ +{ + ".url": { + "certimate.Application": { + "title": "certimate", + "icon": "images/icon_{0}.png", + "type": "url", + "protocol": "", + "port": "8080", + "url": "/", + "allUsers": false + } + } +} diff --git a/app/ui/images/icon_256.png b/app/ui/images/icon_256.png new file mode 100644 index 0000000..b30c921 Binary files /dev/null and b/app/ui/images/icon_256.png differ diff --git a/app/ui/images/icon_64.png b/app/ui/images/icon_64.png new file mode 100644 index 0000000..4c85b2b Binary files /dev/null and b/app/ui/images/icon_64.png differ diff --git a/cmd/config_callback b/cmd/config_callback new file mode 100644 index 0000000..f96cbfb --- /dev/null +++ b/cmd/config_callback @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called after the user change environment variables in application setting page. + +exit 0 \ No newline at end of file diff --git a/cmd/config_init b/cmd/config_init new file mode 100644 index 0000000..cacd475 --- /dev/null +++ b/cmd/config_init @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called before the user change environment variables in application setting page. + +exit 0 \ No newline at end of file diff --git a/cmd/install_callback b/cmd/install_callback new file mode 100644 index 0000000..c7f9afa --- /dev/null +++ b/cmd/install_callback @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called after the user installs the application. + +exit 0 \ No newline at end of file diff --git a/cmd/install_init b/cmd/install_init new file mode 100644 index 0000000..9ee0f11 --- /dev/null +++ b/cmd/install_init @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called before the user installs the application. + +exit 0 \ No newline at end of file diff --git a/cmd/main b/cmd/main new file mode 100644 index 0000000..a9488c3 --- /dev/null +++ b/cmd/main @@ -0,0 +1,108 @@ +#!/bin/bash + +LOG_FILE="${TRIM_PKGVAR}/info.log" +PID_FILE="${TRIM_PKGVAR}/app.pid" + +# write the command to start your program here +CMD="" + +log_msg() { + echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> ${LOG_FILE} +} + +start_process() { + if status; then + return 0 + fi + + log_msg "Starting process ..." + # run cmd to start process + bash -c "${CMD}" >> ${LOG_FILE} 2>&1 & + # write pid to pidfile + printf "%s" "$!" > ${PID_FILE} + # log_msg "CMD = ${CMD}" + # log_msg "pid = $!" + return 0 +} + +stop_process() { + log_msg "Stopping process ..." + + if [ -r "${PID_FILE}" ]; then + pid=$(head -n 1 "${PID_FILE}" | tr -d '[:space:]') + + log_msg "pid=${pid}" + if ! check_process "${pid}"; then + # process not exist, delete pidfile + rm -f "${PID_FILE}" + log_msg "remove pid file 1" + return + fi + + log_msg "send TERM signal to PID:${pid}..." + kill -TERM ${pid} >> ${LOG_FILE} 2>&1 + + local count=0 + while check_process "${pid}" && [ $count -lt 10 ]; do + sleep 1 + count=$((count + 1)) + log_msg "waiting process terminal... (${count}s/10s)" + done + + if check_process "${pid}"; then + log_msg "send KILL signal to PID:${pid}..." + kill -KILL "${pid}" + sleep 1 + rm -f "${PID_FILE}" + else + log_msg "process killed... " + fi + fi + + return 0 +} + +check_process() { + local pid=$1 + if kill -0 "${pid}" 2>/dev/null; then + return 0 # process exist + else + return 1 # process not exist + fi +} + +status() { + if [ -f "${PID_FILE}" ]; then + pid=$(head -n 1 "${PID_FILE}" | tr -d '[:space:]') + if check_process "${pid}"; then + return 0 + else + # Process is not running but pidfile exists - clean it up + rm -f "${PID_FILE}" + fi + fi + + return 1 +} + +case $1 in +start) + # run start command. exit 0 if success, exit 1 if failed + start_process + ;; +stop) + # run stop command. exit 0 if success, exit 1 if failed + stop_process + ;; +status) + # check application status command. exit 0 if running, exit 3 if not running + if status; then + exit 0 + else + exit 3 + fi + ;; +*) + exit 1 + ;; +esac \ No newline at end of file diff --git a/cmd/uninstall_callback b/cmd/uninstall_callback new file mode 100644 index 0000000..52f5bf0 --- /dev/null +++ b/cmd/uninstall_callback @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called after the user uninstalls the application. + +exit 0 \ No newline at end of file diff --git a/cmd/uninstall_init b/cmd/uninstall_init new file mode 100644 index 0000000..52f5bf0 --- /dev/null +++ b/cmd/uninstall_init @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called after the user uninstalls the application. + +exit 0 \ No newline at end of file diff --git a/cmd/upgrade_callback b/cmd/upgrade_callback new file mode 100644 index 0000000..80ae554 --- /dev/null +++ b/cmd/upgrade_callback @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called after the user upgrades the application. + +exit 0 \ No newline at end of file diff --git a/cmd/upgrade_init b/cmd/upgrade_init new file mode 100644 index 0000000..997e45d --- /dev/null +++ b/cmd/upgrade_init @@ -0,0 +1,5 @@ +#!/bin/bash + +### This script is called before the user upgrades the application. + +exit 0 \ No newline at end of file diff --git a/config/privilege b/config/privilege new file mode 100644 index 0000000..ea01bc5 --- /dev/null +++ b/config/privilege @@ -0,0 +1,6 @@ +{ + "defaults": + { + "run-as": "package" + } +} \ No newline at end of file diff --git a/config/resource b/config/resource new file mode 100644 index 0000000..c1198c8 --- /dev/null +++ b/config/resource @@ -0,0 +1,28 @@ +{ + "data-share": + { + "shares": + [ + { + "name": "certimate", + "permission": + { + "rw": + [ + "certimate" + ] + } + }, + { + "name": "certimate/data", + "permission": + { + "rw": + [ + "certimate" + ] + } + } + ] + } +} \ No newline at end of file diff --git a/manifest b/manifest new file mode 100644 index 0000000..c0ca777 --- /dev/null +++ b/manifest @@ -0,0 +1,10 @@ +appname = certimate +version = 1.0.0 +display_name = display-name +desc = app-description +arch = x86_64 +source = thirdparty +maintainer = your-name +distributor = your-name +desktop_uidir = ui +desktop_applaunchname = certimate.Application