1. Create a desktop shortcut. Add the following code to the postinst script file mentioned
in the previous article on the association between files and programs in deb packaging :
me=$(who)
curuser=${me%% *}
rootuser="root"
if [ "$curuser" = "$rootuser" ]; then
echo "root user"
myhome=/root/
else
echo "no root user"
echo $curuser
myhome=/home/$curuser/
fi
cp /opt/apps/abc/entries/applications/abc.desktop $myhome/Desktop/ #创建桌面快捷方式,abc是应用程序名
2. Delete dependent files
Description: There are important files (log files, configuration files) that require read and write permissions in my application. I put them in a hidden folder in the /home/username directory. I want to uninstall the program .abc
. Delete this folder at the same time. Then I create a new postrm script file (without suffix) in the debian folder used in the
packaging process ( linux system generates deb package ), and enter the following code:
#!/bin/bash
#在用户目录下找到并卸载掉.abc文件夹
find ${home} -type d -name '.abc'|xargs rm -fr
The contents of the debian folder at this time:
Just regenerate the deb package.