[OE-core] [RFC] opkg: avoid running postinst scripts twice when using systemd
Alexander Kanavin
alexander.kanavin at linux.intel.com
Thu Dec 14 15:14:46 UTC 2017
On 12/14/2017 04:57 PM, Stefan Agner wrote:
> On 2017-12-14 15:55, Alexander Kanavin wrote:
>> On 12/14/2017 04:41 PM, Stefan Agner wrote:
>>
>>> I think removing the Opkg first boot systemd service (as the initial
>>> patch does) is the correct first step.
>>>
>>> However, it currently still leads to a second copy of the postinst
>>> scripts in /etc if package management is enabled.
>>> I am pretty sure that adding if delayed_postinsts and not
>>> runtime_pkgmanage: should resolve the problem for ipk/deb fully: With
>>> that run-postinsts will run "opkg configure"/"dpkg --configure -a"
>>> respectively when package management is installed, and those command
>>> will run all postinst correctly.
>>
>> Why is the second copy a problem? Can you elaborate? Don't describe
>> the fix, describe the issue.
>>
>> From what I can see, run-postinsts will execute opkg configure if opkg
>> is available, or run the scripts directly if opkg is not available -
>> which is fine. Why do you need to avoid saving the scripts in /etc if
>> opkg is installed?
>
> No, it will call the scripts in /etc/*-postinsts (it bails out of the
> for loop if the post inst dir is there...)
Let's look at the code. Can you point out what the faulty code path is?
# the order of this list is important, do not change!
backend_list="rpm deb ipk"
pm_installed=false
for pm in $backend_list; do
pi_dir="#SYSCONFDIR#/$pm-postinsts"
if [ ! -d $pi_dir ]; then
continue
fi
# found the package manager, it has postinsts
case $pm in
"deb")
if [ -s "#LOCALSTATEDIR#/lib/dpkg/status" ]; then
pm_installed=true
fi
;;
"ipk")
if [ -s "#LOCALSTATEDIR#/lib/opkg/status" ]; then
pm_installed=true
fi
;;
esac
break
done
....
if $pm_installed; then
case $pm in
"ipk")
eval opkg configure $append_log
;;
"deb")
eval dpkg --configure -a $append_log
;;
esac
else
exec_postinst_scriptlets
fi
# since all postinstalls executed successfully, remove the postinstalls
directory
# and the rcS.d link
if [ $remove_pi_dir = 1 ]; then
rm -rf $pi_dir
remove_rcsd_link
fi
Alex
More information about the Openembedded-core
mailing list