48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
# post_install: 在软件包安装后执行
|
|
post_install() {
|
|
echo "Checking for 'smart' user..."
|
|
if ! id -u smart &>/dev/null; then
|
|
echo "WARNING: User 'smart' does not exist. Please create the 'smart' user for SmartTMS to function correctly."
|
|
echo "You can create it with: sudo useradd -m smart"
|
|
fi
|
|
|
|
echo "Reloading systemd configuration, enabling and starting smarttms.service..."
|
|
systemctl daemon-reload >/dev/null 2>&1 || :
|
|
systemctl enable smarttms.service >/dev/null 2>&1 || :
|
|
systemctl start smarttms.service >/dev/null 2>&1 || :
|
|
|
|
echo "Updating desktop database..."
|
|
update-desktop-database /usr/share/applications >/dev/null 2>&1 || :
|
|
|
|
echo "SmartTMS application installed to /home/smart/.tms3."
|
|
echo "A systemd service 'smarttms.service' has been enabled and started."
|
|
echo "A sudoers.d entry for 'smart' user has been added."
|
|
echo "Desktop shortcut 'tmsrestart.desktop' is available."
|
|
echo "Please ensure the 'smart' user exists and has appropriate permissions for /home/smart/.tms3."
|
|
}
|
|
|
|
# pre_remove: 在软件包卸载前执行
|
|
pre_remove() {
|
|
echo "Stopping and disabling smarttms.service..."
|
|
systemctl stop smarttms.service >/dev/null 2>&1 || :
|
|
systemctl disable smarttms.service >/dev/null 2>&1 || :
|
|
}
|
|
|
|
# post_remove: 在软件包卸载后执行
|
|
post_remove() {
|
|
echo "Reloading systemd configuration after removal..."
|
|
systemctl daemon-reload >/dev/null 2>&1 || :
|
|
|
|
echo "Updating desktop database after removal..."
|
|
update-desktop-database /usr/share/applications >/dev/null 2>&1 || :
|
|
|
|
local _app_base_dir="/home/smart/.tms3"
|
|
if [ -d "${_app_base_dir}" ]; then
|
|
rm -rf "${_app_base_dir}" >/dev/null 2>&1 || :
|
|
fi
|
|
|
|
echo "SmartTMS application has been removed."
|
|
echo "Note: User 'smart' and its home directory are NOT removed."
|
|
echo "Any user-generated data in /home/smart/.tms3 (not tracked by the package) remains."
|
|
}
|