mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-03 07:54:28 +01:00
obuspa: init: fix manipulating USP_BOARD_IFNAME env var in .profile
This addresses two problems: 1. `sed 'g/export USP_BOARD_NAME/d'` would erase all the lines in the affected file, regardless of whether there was a match or not. Replace this with `sed '/foo/d'`, which correctly deletes just the affected lines. 2. Changing an `interface`/`ifname` in UCI configuration would end up appending to /root/.profile due to how the control flow was written.
This commit is contained in:
parent
c9bc7a3dea
commit
8c867fc829
2 changed files with 9 additions and 13 deletions
|
|
@ -5,7 +5,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=5.0.0.8
|
||||
PKG_VERSION:=5.0.0.9
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
|
|
|||
|
|
@ -699,20 +699,16 @@ configure_obuspa() {
|
|||
|
||||
if [ -n "${ifname}" ]; then
|
||||
procd_set_param env USP_BOARD_IFNAME="${ifname}"
|
||||
# Set this variable for root user and obuspa -c tool
|
||||
fi
|
||||
|
||||
if [ -z "${ifname}" ] || ! grep -F -q "export USP_BOARD_IFNAME=${ifname}" "${PROFILE}"; then
|
||||
if [ -f "${PROFILE}" ]; then
|
||||
if grep -q "export USP_BOARD_IFNAME=${ifname}" ${PROFILE}; then
|
||||
if grep -q "export USP_BOARD_IFNAME" ${PROFILE}; then
|
||||
sed -i "g/export USP_BOARD_IFNAME/d" ${PROFILE}
|
||||
fi
|
||||
fi
|
||||
sed -i "/export USP_BOARD_IFNAME/d" "${PROFILE}"
|
||||
fi
|
||||
echo "export USP_BOARD_IFNAME=${ifname}" >> ${PROFILE}
|
||||
else
|
||||
if [ -f "$PROFILE" ]; then
|
||||
if grep -q "export USP_BOARD_IFNAME" ${PROFILE}; then
|
||||
sed -i "g/export USP_BOARD_IFNAME/d" ${PROFILE}
|
||||
fi
|
||||
|
||||
if [ -n "${ifname}" ]; then
|
||||
# Set this variable for root user and obuspa -c tool
|
||||
echo "export USP_BOARD_IFNAME=${ifname}" >> "${PROFILE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue