feat: support build deb
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
Package: WFC
|
||||
Version: 1.0.7-YYYYMMDD
|
||||
Version: 1.0.7
|
||||
Section: WFC
|
||||
Prioritt: optional
|
||||
Architecture: amd64
|
||||
Maintainer: wfc
|
||||
Depends:
|
||||
Description: WANFi Controller
|
||||
Description: WANFi Control and Billing System
|
||||
|
||||
|
||||
92
debbuild/DEBIAN/postinst
Normal file → Executable file
92
debbuild/DEBIAN/postinst
Normal file → Executable file
@@ -1,94 +1,14 @@
|
||||
# !/bin/bash
|
||||
|
||||
WFCRootDir=/opt/wfc
|
||||
SystemdRootDir=/usr/lib/systemd/system
|
||||
WFCEtcDir=${WFCRootDir}/etc
|
||||
FERootDir=${WFCRootDir}/nginx/html/dist
|
||||
wfcBinDir=${WFCRootDir}/bin
|
||||
UsrLocalBinDir=/usr/local/bin
|
||||
wfcDaemon=wfcd
|
||||
NginxEtcDir=/etc/nginx
|
||||
NginxConfDir=${NginxEtcDir}/conf.d
|
||||
CFileList="restconf.yaml crontask.yaml tasks.yaml sshsvc.yaml capconf.yaml wfc.conf"
|
||||
LogoFileList="zh_brand.png zh_icon.png en_brand.png en_icon.png"
|
||||
wfc_root_dir=/opt/wfc
|
||||
systemd_dir=/etc/systemd/system
|
||||
fe_dist_dir=${wfc_root_dir}/opt/wfc/docker/nginx/html/dist
|
||||
wfc_bin_dir=${wfc_root_dir}/bin
|
||||
|
||||
echo ""
|
||||
echo "* To start/stop/restart/status wfc service, please run:"
|
||||
echo " sudo systemctl start/stop/restart/status restagent.service"
|
||||
echo " or run: "
|
||||
echo " sudo /usr/local/wfc/bin/wfcsvc.sh start/stop/restart/status"
|
||||
echo ""
|
||||
|
||||
chmod +rx ${WFCRootDir}/bin/*
|
||||
chmod +rx ${WFCRootDir}/*
|
||||
chmod +rx ${UsrLocalBinDir}/*
|
||||
chmod -R 755 ${WFCRootDir}/htdocs/front
|
||||
|
||||
for CFile in ${CFileList}; do
|
||||
if [ ! -e "${WFCEtcDir}/${CFile}" ]; then
|
||||
cp -f ${WFCEtcDir}/default/${CFile} ${WFCEtcDir}
|
||||
else
|
||||
# mv -f ${WFCEtcDir}/${CFile} ${WFCEtcDir}/${CFile}.bak
|
||||
# cp -f ${WFCEtcDir}/default/${CFile} ${WFCEtcDir}
|
||||
if [ -e "${WFCBinDir}/upgconf.sh" ]; then
|
||||
${WFCBinDir}/upgconf.sh
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -e "${FERootDir}/config.js" ]; then
|
||||
cp ${FERootDir}/default/config.js ${FERootDir};
|
||||
fi
|
||||
|
||||
for LogoFile in ${LogoFileList}; do
|
||||
if [ ! -e "${WFCStaticDir}/logo/${LogoFile}" ]; then
|
||||
cp ${WFCStaticDir}/wfc.d/logo/${LogoFile} ${WFCStaticDir}/logo;
|
||||
fi
|
||||
done
|
||||
|
||||
if ! id -u wfc >/dev/null 2>&1 ; then
|
||||
useradd -d /opt/wfc -m -s /bin/bash -pwfc123 wfc;
|
||||
mkdir -p /opt/wfc/ftp
|
||||
else
|
||||
echo "user wfc exist";
|
||||
fi
|
||||
|
||||
if [ ! -e "${NginxConfDir}/wfc.conf" ]; then
|
||||
mkdir -p ${NginxConfDir}
|
||||
cp -f ${WFCEtcDir}/nginx/wfc.conf ${NginxConfDir};
|
||||
fi
|
||||
chmod +rx ${wfc_root_dir}/bin/*
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable wfccontrol.service
|
||||
|
||||
# disable auto upgrade
|
||||
systemctl disable --now unattended-upgrades
|
||||
|
||||
systemctl enable restagent.service
|
||||
systemctl enable crontask.service
|
||||
systemctl enable sshsvc.service
|
||||
systemctl enable captrace.service
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
# read environment parameter and to do
|
||||
if [ "$M_PARAM" = "install" -o "$M_PARAM" = "upgrade" ]; then
|
||||
echo "M parameter: $M_PARAM"
|
||||
if [ -n "$C_PARAM" ]; then
|
||||
echo "C parameter: $C_PARAM"
|
||||
${WFCRootDir}/bin/setwfc.sh -m $M_PARAM -c $C_PARAM
|
||||
else
|
||||
${WFCRootDir}/bin/setwfc.sh -m $M_PARAM
|
||||
fi
|
||||
# exit while failed to run setwfc.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "setwfc.sh execution failed. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "Starting WFC service ... "
|
||||
systemctl start crontask.service
|
||||
systemctl start sshsvc.service
|
||||
systemctl start captrace.service
|
||||
systemctl start restagent.service
|
||||
echo "done"
|
||||
|
||||
21
debbuild/DEBIAN/postrm
Normal file → Executable file
21
debbuild/DEBIAN/postrm
Normal file → Executable file
@@ -1,23 +1,6 @@
|
||||
# !/bin/bash
|
||||
|
||||
#rm -rf /usr/local/omc
|
||||
rm -rf /etc/nginx/conf.d/omc.conf
|
||||
rm -f /usr/local/bin/omcd
|
||||
|
||||
systemctl daemon-reload
|
||||
# systemctl stop wfccontrol.service
|
||||
systemctl disable wfccontrol.service
|
||||
|
||||
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
|
||||
echo -n "Stopping OMC service ... "
|
||||
systemctl stop restagent.service
|
||||
systemctl stop crontask.service
|
||||
systemctl stop sshsvc.service
|
||||
systemctl stop captrace.service
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
systemctl disable restagent.service
|
||||
systemctl disable crontask.service
|
||||
systemctl disable sshsvc.service
|
||||
systemctl disable captrace.service
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
16
debbuild/DEBIAN/preinst
Normal file → Executable file
16
debbuild/DEBIAN/preinst
Normal file → Executable file
@@ -1,16 +1,8 @@
|
||||
# !/bin/bash
|
||||
|
||||
systemctl daemon-reload
|
||||
if systemctl list-units --type=service --all | grep -q 'restagent.service'; then
|
||||
echo -n "Stopping WFC service ... "
|
||||
systemctl stop restagent.service
|
||||
echo "done"
|
||||
fi
|
||||
fe_dist_dir=/opt/wfc/docker/nginx/html/dist
|
||||
|
||||
FERootDir=/usr/local/omc/htdocs/front
|
||||
|
||||
# apt-get install zip
|
||||
# clear front-end old hash js files
|
||||
rm -rf ${FERootDir}/assets
|
||||
rm -rf ${FERootDir}/js
|
||||
rm -rf ${FERootDir}/index.*.js
|
||||
rm -rf ${fe_dist_dir}/sys
|
||||
rm -rf ${fe_dist_dir}/u
|
||||
|
||||
|
||||
7
debbuild/DEBIAN/prerm
Executable file
7
debbuild/DEBIAN/prerm
Executable file
@@ -0,0 +1,7 @@
|
||||
# !/bin/bash
|
||||
|
||||
wfc_bin_dir=/opt/wfc/bin
|
||||
|
||||
${wfc_bin_dir}/wfccontrol.sh stop
|
||||
${wfc_bin_dir}/wfcsetup.sh rm all
|
||||
|
||||
Reference in New Issue
Block a user