40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
# pre_install 钩子在安装文件复制到系统之前运行
|
|
pre_install() {
|
|
echo "stop pure-ftpd service"
|
|
systemctl stop pure-ftpd.service
|
|
}
|
|
|
|
# post_install: 在软件包安装后执行
|
|
post_install() {
|
|
echo "Checking pure-ftpd config and bakup"
|
|
|
|
[ -f /etc/pure-ftpd/pure-ftpd.conf ] && mv /etc/pure-ftpd/pure-ftpd.conf /etc/pure-ftpd/pure-ftpd.conf.bakup
|
|
[ -f /etc/pureftpd.passwd ] && mv /etc/pureftpd.passwd /etc/pureftpd.passwd.bakup
|
|
[ -f /etc/pureftpd.pdb ] && mv /etc/pureftpd.pdb /etc/pureftpd.pdb.bakup
|
|
|
|
mv /etc/pure-ftpd/pure-ftpd.conf.tms /etc/pure-ftpd/pure-ftpd.conf
|
|
mv /etc/pureftpd.passwd.tms /etc/pureftpd.passwd
|
|
mv /etc/pureftpd.pdb.tms /etc/pureftpd.pdb
|
|
|
|
echo "start pure-ftpd.service"
|
|
|
|
systemctl start pure-ftpd.service
|
|
systemctl enable pure-ftpd.service
|
|
}
|
|
|
|
# pre_remove: 在软件包卸载前执行
|
|
pre_remove() {
|
|
echo "Stopping and disabling pure-ftpd.service..."
|
|
systemctl stop pure-ftpd.service
|
|
systemctl disable pure-ftpd.service
|
|
}
|
|
|
|
# post_remove: 在软件包卸载后执行
|
|
post_remove() {
|
|
echo "Reloading systemd configuration after removal..."
|
|
[ -f /etc/pure-ftpd/pure-ftpd.conf.bakup ] && mv /etc/pure-ftpd/pure-ftpd.conf.bakup /etc/pure-ftpd/pure-ftpd.conf
|
|
[ -f /etc/pureftpd.passwd.bakup ] && mv /etc/pureftpd.passwd.bakup /etc/pureftpd.passwd
|
|
[ -f /etc/pureftpd.pdb.bakup ] && mv /etc/pureftpd.pdb.bakup /etc/pureftpd.pdb
|
|
|
|
}
|