Skip to content

Commit

Permalink
修复影响系统 无法启动的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gdy666 committed Feb 23, 2025
1 parent 31e54e1 commit 4ef3118
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 110 deletions.
2 changes: 1 addition & 1 deletion luci-app-lucky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-lucky
PKG_VERSION:=2.2.1
PKG_VERSION:=2.2.2
PKG_RELEASE:=1

LUCI_TITLE:=LuCI Support for lucky
Expand Down
Empty file.
61 changes: 0 additions & 61 deletions luci-app-lucky/root/etc/uci-defaults/99_lucky

This file was deleted.

13 changes: 0 additions & 13 deletions luci-app-lucky/root/etc/uci-defaults/99_lucky_luci

This file was deleted.

35 changes: 14 additions & 21 deletions lucky/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=lucky
PKG_VERSION:=2.15.7
PKG_RELEASE:=3
PKG_RELEASE:=9
PKGARCH:=all
LUCKY_CONF_DIR := /etc/config/lucky.daji
LUCKY_TMP_BACKUP := /tmp/luckyconfdir
Expand Down Expand Up @@ -71,26 +71,6 @@ define Build/Prepare
tar -xzvf $(PKG_BUILD_DIR)/$(PKG_NAME)_$(PKG_VERSION)_Linux_$(LUCKY_ARCH).tar.gz -C $(PKG_BUILD_DIR)
endef

# define Package/$(PKG_NAME)/preinst
# #!/bin/sh
# mkdir -p $(LUCKY_TMP_BACKUP)
# if [ -d $(LUCKY_CONF_DIR) ]; then
# cp -a $(LUCKY_CONF_DIR)/. $(LUCKY_TMP_BACKUP)/
# else
# mkdir -p $(LUCKY_CONF_DIR)
# chmod 755 $(LUCKY_CONF_DIR)
# fi
# endef

# define Package/$(PKG_NAME)/postinst
# #!/bin/sh
# if [ -n "$(ls -A $(LUCKY_TMP_BACKUP))" ]; then
# mkdir -p $(LUCKY_CONF_DIR)
# cp -a $(LUCKY_TMP_BACKUP)/. $(LUCKY_CONF_DIR)/
# fi
# rm -rf $(LUCKY_TMP_BACKUP)
# endef

define Package/$(PKG_NAME)/postrm
#!/bin/sh
# 仅尝试移除空目录,保留用户配置
Expand All @@ -110,6 +90,19 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)$(LUCKY_CONF_DIR)/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lucky $(1)/usr/bin/lucky
$(INSTALL_BIN) ./files/lucky.init $(1)/etc/init.d/lucky

# Install to a temporary location
$(INSTALL_CONF) $(CURDIR)/files/luckyuci $(1)/etc/config/lucky.default
endef

define Package/$(PKG_NAME)/postinst
#!/bin/sh
# Copy default config if it doesn't exist
if [ ! -f /etc/config/lucky ]; then
mv /etc/config/lucky.default /etc/config/lucky
fi
rm -f /etc/config/lucky.default
exit 0
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
28 changes: 14 additions & 14 deletions lucky/files/lucky.init
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ USE_PROCD=1

PROG=/usr/bin/lucky

DEFAULT_PRO_CONF='/etc/config/lucky.daji' #默认配置文件夹路径
DEFAULT_PRO_CONF='/etc/config/lucky.daji/' #默认配置文件夹路径
PRO_CONF=$DEFAULT_PRO_CONF
CONFDIR=$PRO_CONF

Expand All @@ -27,7 +27,7 @@ get_config() {
init_config_params(){
config_load lucky
config_foreach get_config
CONFDIR=$(dirname $PRO_CONF)
CONFDIR=$PRO_CONF
}


Expand All @@ -42,21 +42,21 @@ log_output(){

lucky_run(){


if [ -s ${UCI_CONF} ];then #存在uci配置文件,从uci配置读取信息
init_config_params
init_conf_dir #lucky启动配置文件路径所在文件夹不存在时创建
[ x$enabled == x1 ] || return 1
procd_open_instance
procd_set_param respawn
procd_set_param command $PROG -cd "$PRO_CONF"
procd_close_instance
else
init_conf_dir #未安装luci的uci,使用默认文件夹,若不存在,创建
procd_open_instance
procd_set_param respawn
procd_set_param command $PROG -cd "$PRO_CONF"
procd_close_instance
[ x$enabled = x1 ] || return 1
fi

init_conf_dir
procd_open_instance
procd_set_param command $PROG
procd_append_param command -cd "$CONFDIR"
procd_set_param respawn
procd_set_param stderr 1
procd_close_instance


log_output "lucky is start."

}
Expand Down
4 changes: 4 additions & 0 deletions lucky/files/luckyuci
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config lucky
option enabled '1'
option logger '1'
option configdir '/etc/config/lucky.daji'

0 comments on commit 4ef3118

Please sign in to comment.