初始化项目

This commit is contained in:
Krcia 2025-12-03 09:24:05 +08:00
commit ec2d1585af
22 changed files with 236 additions and 0 deletions

5
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

12
.idea/certimate.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/certimate.iml" filepath="$PROJECT_DIR$/.idea/certimate.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
ICON.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
ICON_256.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
app/bin/certimate Normal file

Binary file not shown.

13
app/ui/config Normal file
View File

@ -0,0 +1,13 @@
{
".url": {
"certimate.Application": {
"title": "certimate",
"icon": "images/icon_{0}.png",
"type": "url",
"protocol": "",
"port": "8080",
"url": "/",
"allUsers": false
}
}
}

BIN
app/ui/images/icon_256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
app/ui/images/icon_64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

5
cmd/config_callback Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called after the user change environment variables in application setting page.
exit 0

5
cmd/config_init Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called before the user change environment variables in application setting page.
exit 0

5
cmd/install_callback Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called after the user installs the application.
exit 0

5
cmd/install_init Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called before the user installs the application.
exit 0

108
cmd/main Normal file
View File

@ -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

5
cmd/uninstall_callback Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called after the user uninstalls the application.
exit 0

5
cmd/uninstall_init Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called after the user uninstalls the application.
exit 0

5
cmd/upgrade_callback Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called after the user upgrades the application.
exit 0

5
cmd/upgrade_init Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
### This script is called before the user upgrades the application.
exit 0

6
config/privilege Normal file
View File

@ -0,0 +1,6 @@
{
"defaults":
{
"run-as": "package"
}
}

28
config/resource Normal file
View File

@ -0,0 +1,28 @@
{
"data-share":
{
"shares":
[
{
"name": "certimate",
"permission":
{
"rw":
[
"certimate"
]
}
},
{
"name": "certimate/data",
"permission":
{
"rw":
[
"certimate"
]
}
}
]
}
}

10
manifest Normal file
View File

@ -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