You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.0 KiB
106 lines
3.0 KiB
3 years ago
|
{% calculate comment='#', unbound %}
|
||
|
# vim: set syntax=sh
|
||
|
|
||
|
# Copyright 2014-2015 Calculate Ltd. http://www.calculate-linux.org
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
CL_UPDATE_PROG="/usr/sbin/cl-core"
|
||
|
RUN_CORE="/usr/bin/python2 ${CL_UPDATE_PROG}"
|
||
|
CORE_METHOD="--method core_setup"
|
||
|
[[ -d /var/lib/calculate ]] || mkdir /var/lib/calculate
|
||
|
|
||
|
# setup package and create postmerge package list
|
||
|
setup_merge_package() {
|
||
|
rm -f /var/lib/calculate/-postmerge
|
||
|
if ! [[ -f /var/lib/calculate/calculate-core/cache/merge-setup.list ]] ||
|
||
|
grep ${CATEGORY}/${PN} /var/lib/calculate/calculate-core/cache/merge-setup.list &>/dev/null
|
||
|
then
|
||
|
if [ -f ${CL_UPDATE_PROG} ] && check_skip
|
||
|
then
|
||
|
if ! CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${RUN_CORE} ${CORE_METHOD} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT/\/*} --pkg-category ${CATEGORY} --pkg-path "/" --pkg-name ${PN}
|
||
|
then
|
||
|
echo $CATEGORY $PN $PVR ${SLOT/\/*} >>/var/lib/calculate/calculate-core/setup-failed.list
|
||
|
return 1
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
rm -f /var/lib/calculate/-runlevels-$PN
|
||
|
}
|
||
|
|
||
|
# remove mark: package updating
|
||
|
clean_update_mark() {
|
||
|
rm -f /var/lib/calculate/-merge-$PN-*
|
||
|
}
|
||
|
|
||
|
# remove contents file which need for cl-core-setup
|
||
|
clean_contents_mark() {
|
||
|
rm -f /var/lib/calculate/-CONTENTS-*
|
||
|
}
|
||
|
|
||
|
# mark: package updating
|
||
|
mark_update_package() {
|
||
|
touch "/var/lib/calculate/-merge-$PN--${SLOT/\/*}-$PPID"
|
||
|
}
|
||
|
|
||
|
# save services runlevels
|
||
|
save_runlevels() {
|
||
|
find /etc/runlevels/{default,boot,sysinit,shutdown} >/var/lib/calculate/-runlevels-$PN
|
||
|
}
|
||
|
|
||
|
# dispatching unmerge or update package
|
||
|
pkg_postrm_dispatch() {
|
||
|
if [[ ! -f /var/lib/calculate/-merge-$PN--${SLOT/\/*}-$PPID ]]
|
||
|
then
|
||
|
pkg_postrm_unmerge
|
||
|
else
|
||
|
pkg_postrm_update
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# restore files of packages which stashed for resolve automagic depends
|
||
|
unstash_automagic_requires() {
|
||
|
local automagic_dir=/var/lib/calculate/calculate-builder/automagic-requires
|
||
|
if [[ -d $automagic_dir ]]
|
||
|
then
|
||
|
# -K - need to resolve lib -> lib64 symlink problem
|
||
|
# -X - to keep file capabilities
|
||
|
/usr/bin/rsync -aXKx ${automagic_dir}/ / && rm -rf ${automagic_dir}
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# setup package umerging
|
||
|
pkg_postrm_unmerge() {
|
||
|
if ! [[ -f /var/lib/calculate/calculate-core/cache/merge-setup.list ]] ||
|
||
|
grep ${CATEGORY}/${PN} /var/lib/calculate/calculate-core/cache/merge-setup.list &>/dev/null
|
||
|
then
|
||
|
[ -f ${CL_UPDATE_PROG} ] && check_skip && ${RUN_CORE} ${CORE_METHOD} --no-progress --pkg-version ${PVR} --pkg-slot ${SLOT/\/*} --pkg-category ${CATEGORY} --pkg-path / --pkg-name ${PN}
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# save contents file for correct package updating by cl-core-setup
|
||
|
pkg_postrm_update() {
|
||
|
cp /var/db/pkg/${CATEGORY}/${PF}/CONTENTS /var/lib/calculate/-CONTENTS-$PN
|
||
|
}
|
||
|
|
||
|
pre_pkg_postrm() {
|
||
|
pkg_postrm_dispatch
|
||
|
clean_update_mark
|
||
|
}
|
||
|
|
||
|
pre_pkg_postinst() {
|
||
|
setup_merge_package
|
||
|
clean_contents_mark
|
||
|
clean_update_mark
|
||
|
unstash_automagic_requires
|
||
|
}
|
||
|
|
||
|
pre_pkg_preinst() {
|
||
|
mark_update_package
|
||
|
save_runlevels
|
||
|
}
|