Добавлены шаблоны sys-apps

baselayout
calculate-utils
dbus
hdparm
memtest86+
openrc
portage
sandbox
shadow
sysvinit
master
parent 67e9cc450a
commit 46c429147f

@ -39,3 +39,8 @@ desktop файл содержит то же самое значение
Из шаблонов samba убран параметр protected (unbound), необходимо проверить новый механизм изменённых пользователем параметров
merge/sys-apps/portage/syncmodule/calculate содержит код, который ссылается на cl-core
Изучить условие subgid sys-apps/shadow (они одинаковые для subuid и subgid)
Из sys-apps/calculate-utils удалены все шаблоны исправляющие код утилит 3.X

@ -0,0 +1 @@
{% calculate append = 'skip' %}

@ -0,0 +1 @@
{% calculate name='etc', package='sys-apps/baselayout' %}

@ -0,0 +1,8 @@
{% calculate format='regex' %}
<reg>(# 'mount -t auto' command.
#
)
</reg>
<text>\1ntfs-3g
</text>

@ -0,0 +1,5 @@
{% if install.os.linux.subname %}
{{ install.os.linux.name }} {{ install.os.linux.ver }} {{ install.os.linux.subname }}
{% else %}
{{ install.os.linux.name }} {{ install.os.linux.ver }}
{% endif %}

@ -0,0 +1,6 @@
{% if install.os.linux.subname %}
Welcome to \n.\O ({{ install.os.linux.name }} {{ install.os.linux.ver }} {{ install.os.linux.subname }})
{% else %}
Welcome to \n.\O ({{ install.os.linux.name }} {{ install.os.linux.ver }})
{% endif %}

@ -0,0 +1,8 @@
{% calculate format='openrc' %}
NAME=Calculate
ID=calculate
PRETTY_NAME="Calculate/Linux"
ANSI_COLOR="1;32"
HOME_URL="http://www.calculate-linux.org"
SUPPORT_URL="http://www.calculate-linux.org/main/en/community"
BUG_REPORT_URL="http://www.calculate-linux.org/projects/calculatelinux/issues"

@ -0,0 +1,6 @@
{% calculte format='procmail' %}
# IssueID 848
{% if not os.subsystem }}
vm.dirty_background_ratio = 1
vm.dirty_ratio = 3
{% endif %}

@ -0,0 +1 @@
{% calculate append='skip', package='sys-apps/calculate-utils' %}

@ -0,0 +1 @@
{% calculate path='/etc/runlevels' %}

@ -0,0 +1,2 @@
{% calculate append="link", source="/etc/init.d/zram", custom.runlevels.zram != 'on' or grep('var/lib/calculate/-runlevels-calculate-utils','/zram') %}
{% save.system custom.runlevels.zram = "on" %}

@ -0,0 +1 @@
{% calculate path='/usr/share/calculate', name='xdm', pkg('sys-apps/calculate-utils[desktop]') %}

@ -0,0 +1,3 @@
{% calculate format='regex', multiline %}
<reg>local bg_color=.*$</reg>
<text>local bg_color="{{ custom.theme.dm.splash.color }}"</text>

@ -0,0 +1,3 @@
{% calculate format='regex', multiline %}
<reg>local bg_color=.*$</reg>
<text>local bg_color="{{ custom.theme.dm.splash.color }}"</text>

@ -0,0 +1,5 @@
{% calculate comment='#', path='/usr/share/portage/config/sets' %}
[autodeps]
class = portage.sets.shell.CommandOutputSet
command = cat /var/db/pkg/*/*/autodeps 2>/dev/null | sort | uniq

@ -0,0 +1 @@
{% calculate path='/etc', name='conf.d', install.os.container.type == 'desktop' and pkg('sys-apps/calculate-utils[client]') %}

@ -0,0 +1,3 @@
{% calculate comment='#' %}
rc_keyword="!-lxc"

@ -0,0 +1,15 @@
{% calculate not exists('/etc/conf.d/zram'), unbound %}
# Compression algorithm for zram disk
COMPRESSION="zstd"
# Zram disk size in percent of RAM or absolute value with suffix (K,M,G)
DISKSIZE="200%"
# Start zram swap disk
# swapless - start only for swapless system
# always - start anyway
{% if main.cl.chroot_status %}
START="always"
{% else %}
START="swapless"
{% endif %}

@ -0,0 +1,59 @@
# Calculate chmod=0755
#!/sbin/openrc-run
# Copyright 2020 Mir Calculate. 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
depend()
{
after clock root swap
before localmount
keyword -docker -jail -lxc -openvz -prefix -systemd-nspawn -vserver
}
start()
{
[[ -d /sys/block/zram0 ]] || modprobe zram
if [[ -d /sys/block/zram0 ]]
then
if [[ $START == "always" ]] || [[ -z $(swapon --noheading) ]]
then
ebegin "Activating zram swap devices"
local disksize;
echo ${COMPRESSION:-zstd} >/sys/block/zram0/comp_algorithm
if [[ ${DISKSIZE:-200%} =~ ^([0-9]+)%$ ]]
then
local perc="${BASH_REMATCH[1]}"
local memorysize="$(free -b | awk '{if ($1 == "Mem:") {print $2}}')"
disksize="$(( $memorysize * $perc / 100 ))"
else
disksize="${DISKSIZE}"
fi
echo $disksize >/sys/block/zram0/disksize
mkswap -L zramswap /dev/zram0
swapon -p 100 /dev/zram0 &>/dev/null
fi
fi
eend 0 # If swapon has nothing todo it errors, so always return 0
}
stop()
{
if [[ ${RC_RUNLEVEL} != "shutdown" ]] && [[ -n $(swapon --noheading | grep /dev/zram0) ]]
then
ebegin "Deactivating zram swap devices"
swapoff /dev/zram0 &>/dev/null
echo 1 >/sys/block/zram0/reset
fi
eend 0
}

@ -0,0 +1,11 @@
{% calculate format='kde', path='/usr/share/dbus-1/system-services' %}
[D-BUS Service]
Name=org.calculate.Core
{% for pyver in ('3_6', '3_7', '3_8', '3_9') %}
{% set ptarget = 'python_targets_python_' + pyver|replace('.','_') %}
{% set python_interpreter = '/usr/bin/python' + pyver %}
{% if pkg('dev-python/pygobject[%s]' % ptarget) and pkg('dev-python/dbus-python[%s]' % ptarget) %}
Exec={{ python_interpreter }} /usr/libexec/calculate/cl-dbus-core.py
{% endif %}
{% endfor %}
User=root

@ -0,0 +1,37 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 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
update_cache() {
[[ -x /usr/libexec/calculate/cl-pkg-cache ]] &&
/usr/libexec/calculate/cl-pkg-cache
}
calculate_configurable_package() {
! [[ -f /var/lib/calculate/calculate-core/cache/merge-setup.list ]] ||
grep ${CATEGORY}/${PN} /var/lib/calculate/calculate-core/cache/merge-setup.list &>/dev/null
}
if [[ ${EBUILD_PHASE} == "setup" ]]
then
if tail -5 /var/log/emerge.log | grep -P "\(1 of.*${CATEGORY}/${P}" &>/dev/null
then
update_cache
fi
fi
if [[ ${EBUILD_PHASE} == "postrm" ]]
then
if tail -2 /var/log/emerge.log | grep "*** emerge " &>/dev/null
then
update_cache
fi
fi

@ -0,0 +1,28 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2020 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
calculate_lockfile=/var/calculate/tmp/portage/$CATEGORY/.$PN.calculate_lockfile
calculate_lock_setup() {
if calculate_configurable_package
then
flock -x -w 120 $calculate_lockfile true
fi
}
calculate_unlock_setup() {
if calculate_configurable_package
then
rm $calculate_lockfile
fi
}
[[ $EBUILD_PHASE == "instprep" ]] && calculate_lock_setup

@ -0,0 +1,15 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2014 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
if [[ ${CATEGORY}/${PN} == "sys-auth/nss_ldap" ]] && [[ ${EBUILD_PHASE} == "preinst" ]]
then
mv ${D}/etc/ldap.conf ${D}/etc/ldap.conf.example &>/dev/null
fi

@ -0,0 +1,22 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2020 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
if [[ -d ${D}/lib/modules ]] && [[ ${EBUILD_PHASE} == "preinst" ]]
then
if linux_chkconfig_builtin MODULE_COMPRESS_ZSTD
then
find ${D}/lib/modules -name "*.ko" -exec zstd --rm {} \;
fi
if linux_chkconfig_builtin MODULE_COMPRESS_XZ
then
find ${D}/lib/modules -name "*.ko" -exec xz {} \;
fi
fi

@ -0,0 +1,25 @@
# Calculate comment=# protected
# vim: set syntax=sh
#
# Copyright 2014 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
check_skip() {
declare -A SKIPPKGS=(
["calculate-install"]="1"
["calculate-lib"]="1"
["calculate-console"]="1"
["calculate-console-gui"]="1"
["calculate-core"]="1"
["calculate-desktop"]="1"
["calculate-client"]="1"
["calculate-update"]="1" )
[[ -z ${SKIPPKGS[$PN]} ]]
}

@ -0,0 +1,18 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2019 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_CONFIG=/usr/bin/cl-config
post_pkg_config() {
[ -f ${CL_CONFIG} ] && ${CL_CONFIG} --no-progress --pkg-version ${PVR} \
--pkg-slot ${SLOT/\/*} --pkg-category ${CATEGORY} \
--pkg-name ${PN} --verbose
}

@ -0,0 +1,30 @@
{% 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_CORE_PATCH=/usr/bin/cl-core-patch
[[ -f $CL_CORE_PATCH ]] || CL_CORE_PATCH=/usr/sbin/cl-core-patch
if [[ ${EBUILD_PHASE} == "compile" ]] && [[ -d ${S} ]] && check_skip; then
if ! [[ -f /var/lib/calculate/calculate-core/cache/merge-patch.list ]] ||
grep ${CATEGORY}/${PN} /var/lib/calculate/calculate-core/cache/merge-patch.list &>/dev/null
then
[ -f ${CL_CORE_PATCH} ] && ${CL_CORE_PATCH} --no-progress --pkg-version ${PVR} \
--pkg-slot ${SLOT/\/*} --pkg-category ${CATEGORY} \
--pkg-path ${S} --pkg-name ${PN} --verbose
if [[ $? -eq 2 ]]
then
if /usr/libexec/calculate/cl-variable --value main.cl_template_wrong_patch | grep break &>/dev/null
then
die "Failed to apply Calculate utilities patch"
fi
fi
fi
fi

@ -0,0 +1,108 @@
{% 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"
post_setup_package() {
local remove_dir_list=""
if [ -f ${CL_UPDATE_PROG} ] && [[ $PN == "calculate-utils" ]] && [[ -f /var/lib/calculate/calculate-core/setup-failed.list ]]
then
while read category pkgname mypvr myslot;do
if [[ -n $category ]]
then
pkg_lockfile_dir=/var/calculate/tmp/portage/$category
pkg_lockfile="$pkg_lockfile_dir"/.${pkgname}.calculate_lockfile
if ! [[ -d $pkg_lockfile_dir ]]
then
mkdir -p $pkg_lockfile_dir
remove_dir_list="$remove_dir_list $pkg_lockfile_dir"
fi
(
flock -x -w 1 73 || exit 1;
fuser /var/db/pkg/$category/.${pkgname}*.portage_lockfile &>/dev/null || CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${RUN_CORE} ${CORE_METHOD} --no-progress --pkg-name $pkgname --pkg-category $category --pkg-slot $myslot --pkg-version $mypvr --pkg-path "/";
rm -f /var/lib/calculate/-runlevels-$pkgname
rm $pkg_lockfile
) 73>$pkg_lockfile
fi
done </var/lib/calculate/calculate-core/setup-failed.list
rm -f /var/lib/calculate/calculate-core/setup-failed.list
fi
if [ -f ${CL_UPDATE_PROG} ] && [[ -f /var/lib/calculate/-postmerge ]] && check_skip
then
OLDIFS=$IFS
IFS=/
while read category pkgname;do
[ -d /var/db/pkg/${category}/${pkgname}-* ] || continue
IFS=$OLDIFS
if ! [[ -f /var/lib/calculate/calculate-core/cache/merge-setup.list ]] ||
grep ${category}/${pkgname} /var/lib/calculate/calculate-core/cache/merge-setup.list &>/dev/null
then
pkg_lockfile_dir=/var/calculate/tmp/portage/$category
pkg_lockfile="$pkg_lockfile_dir"/.${pkgname}.calculate_lockfile
if ! [[ -d $pkg_lockfile_dir ]]
then
mkdir -p $pkg_lockfile_dir
remove_dir_list="$remove_dir_list $pkg_lockfile_dir"
fi
(
flock -x -w 1 73 || exit 1;
fuser /var/db/pkg/$category/.${pkgname}*.portage_lockfile &>/dev/null || CTARGET=${CTARGET} GCC_CONFIG_VER=${GCC_CONFIG_VER} ${RUN_CORE} ${CORE_METHOD} --no-progress --pkg-name $pkgname --pkg-category $category --pkg-path "/";
rm $pkg_lockfile
) 73>$pkg_lockfile
fi
IFS=/
done < <(awk '!x[$0]++' /var/lib/calculate/-postmerge)
IFS=$OLDIFS
fi
rm -f /var/lib/calculate/-postmerge
[[ -n $remove_dir_list ]] && rmdir $remove_dir_list
}
fix_kernel_symlink() {
# restore kernel symlink to preferred by cl_install_kernel_build variable
local kernel_build=$(/usr/libexec/calculate/cl-variable --value install.cl_install_kernel_build 2>/dev/null)
if [[ $? -ne 1 ]] && [[ -n $kernel_build ]] && [[ -L /usr/src/linux ]]
then
[[ "$kernel_build" =~ ^[0-9]+\.[0-9]+$ ]] && kernel_build="${kernel_build}."
last_kernel="$(ls -1d /usr/src/linux-${kernel_build}* | sed 's/.*linux-//' | sort -V | tail -1)"
if [[ -n $last_kernel ]]
then
if [[ "$(readlink /usr/src/linux)" != "linux-${last_kernel}" ]]
then
rm /usr/src/linux
ln -sf linux-${last_kernel} /usr/src/linux
fi
fi
fi
}
clean_binary_bdepends() {
local bdeps=$(/usr/libexec/calculate/cl-variable --value update.cl_update_with_bdeps_set 2>/dev/null)
local _instmark=/var/db/pkg/$CATEGORY/$PF/EMERGE_FROM
echo -n $EMERGE_FROM >$_instmark
if [[ $EMERGE_FROM == binary ]] && [[ $bdeps == auto ]]
then
local _bdep=/var/db/pkg/$CATEGORY/$PF/BDEPEND
local _dep=/var/db/pkg/$CATEGORY/$PF/DEPEND
[[ -f $_bdep ]] && mv $_bdep $_bdep.binary
[[ -f $_dep ]] && mv $_dep $_dep.binary
fi
}
post_pkg_postinst() {
[[ "$PN" == "calculate-sources" ]] && fix_kernel_symlink
post_setup_package
calculate_unlock_setup
clean_binary_bdepends
}

@ -0,0 +1,74 @@
{% calculate comment='#', pkg('sys-apps/calculate-server'), unbound %}
# vim: set syntax=sh
#
# Copyright 2014 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
# added for calculate server 2.2
# FUNC: change_permissions
# DESC: change permissions for all files and directories into specified
change_permissions() {
local directory=$1
[[ -d $1 ]] || return
local out="$(getfacl $directory 2>/dev/null)"
if ! (grep -q default:user:900:rwx <<<$out && grep -q ^user:900:rwx <<<$out)
then
setfacl -R -m d:u:900:rwx,u:900:rwx $directory
fi
addwrite ${directory}
# get owner from parent directory
local diruid=$(stat -c"%u" ${directory})
local dirgid=$(stat -c"%g" ${directory})
local dirowner="${diruid}:${dirgid}"
# get permissions from parent directory
local dirmode=0$(stat -c%a ${directory})
# turnoff execute for all (permission for files in parent directory)
if type bc &>/dev/null;
then
local filemode=0$(echo "obase=8;$(( $dirmode & 0666 ))" | bc)
elif type printf &>/dev/null;
then
local filemode=$(printf "0%o" $(( $dirmode & 0666 )) )
else
local filemode=
fi
# set for all files and directories dirowner
find ${directory} \! -uid ${diruid} -o \! -gid ${dirgid} -exec chown ${dirowner} {} \;
# set permissions for all directories in parent directory
find ${directory} \! -perm ${dirmode} -type d -exec chmod ${dirmode} {} \;
if [[ -n $filemode ]]
then
# set permissions for all files in parent directory
find ${directory} \! -perm ${filemode} -type f -exec chmod ${filemode} {} \;
fi
}
# system has "remote" share
if grep "\[remote\]" /etc/samba/smb.conf &>/dev/null
then
pre_pkg_preinst() {
einfo "Performing permissions change for packages directory"
change_permissions ${PKGDIR}
}
post_src_unpack() {
einfo "Performing permissions change for distdir directory"
change_permissions ${PORTAGE_ACTUAL_DISTDIR}
}
else
post_src_unpack() {
:
}
pre_pkg_preinst() {
:
}
fi

@ -0,0 +1,93 @@
{% calculate comment='#', pkg('sys-apps/calculate-server'), unbound %}
# vim: set syntax=sh
#
# Copyright 2016 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
# added for calculate server 2.2
# FUNC: protect_server_files
# DESC: protect server changed files from rewrite
protect_server_files() {
local protected_files=(
"/etc/bind/named.conf"
"/etc/conf.d/sortmilter"
"/etc/dhcp/dhcpd.conf"
"/etc/dhcp/dhcp.ldap"
"/etc/dovecot/conf.d/10-auth.conf"
"/etc/dovecot/conf.d/10-logging.conf"
"/etc/dovecot/conf.d/10-mail.conf"
"/etc/dovecot/conf.d/10-master.conf"
"/etc/dovecot/conf.d/auth-ldap.conf.ext"
"/etc/dovecot/conf.d/auth-system.conf.ext"
"/etc/openldap/slapd.conf"
"/etc/dovecot/dovecot.conf"
"/etc/dovecot/dovecot-ldap.conf"
"/etc/jabber/ejabberd.cfg"
"/etc/jabber/ejabberd.yml"
"/etc/openldap/schema/dnszone.schema"
"/etc/openldap/schema/mail.schema"
"/etc/postfix/ldap-aliases.cf"
"/etc/postfix/ldap-aliases-gr.cf"
"/etc/postfix/ldap-aliases-repl.cf"
"/etc/postfix/ldap-recipient.cf"
"/etc/postfix/ldap-recipient-gr.cf"
"/etc/postfix/ldap-recipient-repl.cf"
"/etc/postfix/main.cf"
"/etc/procmailrc"
"/etc/proftpd/proftpd.conf"
"/etc/samba/smb.conf"
"/etc/squid/squid.conf"
"/etc/squid/squid.ldap"
)
local packages=(
"net-ftp/proftpd"
"net-fs/samba"
"net-mail/dovecot"
"net-misc/dhcp"
"net-dns/bind"
"mail-filter/procmail"
"net-im/ejabberd"
"mail-mta/postfix"
"net-nds/openldap"
"net-proxy/squid"
)
local install_pkg="${CATEGORY}/${PN}"
for pkg in ${packages[@]}
do
if [[ $pkg == $install_pkg ]]
then
for fn in ${protected_files[@]}
do
if [[ -f ${D}/$fn ]]
then
if [[ "$fn" == "/etc/openldap/slapd.conf" ]] && [[ $pkg == "net-nds/openldap" ]]
then
if [[ -f $fn ]]
then
contmd5="$(cat /var/db/pkg/net-nds/openldap-*/CONTENTS | grep " /etc/openldap/slapd.conf " | awk '{print $3}')"
curmd5="$(md5sum $fn | awk '{print $1}')"
if [[ $contmd5 != $curmd5 ]]
then
mv -- "${D}/$fn" "${D}/${fn}.origin"
fi
fi
cp -- "${D}/$fn" "${D}/${fn}.origin"
else
mv -- "${D}/$fn" "${D}/${fn}.origin"
fi
fi
done
break
fi
done
}
post_pkg_preinst() {
protect_server_files
}

@ -0,0 +1,105 @@
{% 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
}

@ -0,0 +1,15 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2014 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
if [[ ${EBUILD_PHASE} == "postinst" ]]
then
echo $RANDOM >>${T}/eclass-debug.log
fi

@ -0,0 +1,37 @@
{% calculate comment='#', unbound %}
# vim: set syntax=sh
#
# Copyright 2014 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
if [[ ${CATEGORY}/${PN} == "sys-libs/db" ]]
then
fix_libdb_6() {
if [[ -f /usr/include/db4.8/db.h ]] &&
[[ -f /usr/include/db4.8/db_185.h ]] &&
[[ -f /usr/lib/libdb-4.8.so ]]
then
ln -sf db4.8/db.h /usr/include/db.h
ln -sf db4.8/db_185.h /usr/include/db_185.h
ln -sf libdb-4.8.so /usr/lib/libdb.so
fi
}
post_pkg_postrm() {
if [[ $PV == '0_rc73' ]]
then
fix_libdb_6
fi
}
post_pkg_postinst() {
if [[ $SLOT == "4.8" ]] && [[ -d /var/db/pkg/sys-libs/db-0_rc73 ]]
then
fix_libdb_6
fi
}
fi

@ -0,0 +1,5 @@
{% calculate exec='/bin/bash', action='!disk' %}
/usr/sbin/cl-core --create-symlink &>/dev/null
true

@ -0,0 +1 @@
{% calculate name='etc', package='sys-apps/dbus' %}

@ -0,0 +1 @@
{% calculate path='/etc/runlevels' %}

@ -0,0 +1,2 @@
{% calculate append="link", source="/etc/init.d/dbus", custom.runlevels.dbus != 'on' or grep('var/lib/calculate/-runlevels-dbus','/dbus') %}
{% save.system custom.runlevels.dbus = "on" %}

@ -0,0 +1 @@
{% calculate path='/etc', name='conf.d', package='sys-apps/hdparm' %}

@ -0,0 +1,5 @@
{% calculate format='openrc' %}
pata_all_args="-d1 -X69 -c1"
sata_all_args=""
all_args=""

@ -0,0 +1 @@
{% calculate path='/etc', name='grub.d', package='sys-apps/memtest86+' %}

@ -0,0 +1,6 @@
{% calculate comment='#', format='regex', multiline, autoupdate %}
<!--
Добавление к записи Memtest86+ возможности запуска без пароля
-->
<reg>(Memtest86\+') (\{)</reg>
<text>\1 --unrestricted \2</text>

@ -0,0 +1 @@
{% calculate append='remove', path='/boot/memtest86plus', name='memtest.netbsd' %}

@ -0,0 +1 @@
{% calculate name='etc', package='sys-apps/openrc' %}

@ -0,0 +1 @@
{% calculate path='/etc/runlevels', name='boot' %}

@ -0,0 +1,2 @@
{% calculate append="link", source="/etc/init.d/consolefont", custom.runlevels.openrc_consolefont != 'on' or grep('var/lib/calculate/-runlevels-openrc','/consolefont') %}
{% save.system custom.runlevels.openrc_consolefont = "on" %}

@ -0,0 +1 @@
{% calculate path='/lib/rc' %}

@ -0,0 +1 @@
{% calculate path='/etc', name='conf.d' %}

@ -0,0 +1,3 @@
{% calculate format='openrc' %}
consolefont="ter-v18n"

@ -0,0 +1,3 @@
{% calculate format='openrc', unbound %}
rc_before="net.lo"

@ -0,0 +1,4 @@
{% calculate comment='#' %}
# If you wish to pass any options to killall5 during shutdown,
# you should do so here.
killall5_opts=""

@ -0,0 +1,4 @@
{% calculate comment='#', format='openrc', install.os.container.type == 'desktop' %}
rc_need="net"
rc_keyword="!-lxc"

@ -0,0 +1,3 @@
{% calculate format='openrc' %}
rc_after="root"

@ -0,0 +1,9 @@
{% calculate format='regex', path='/lib/rc/sh', name='init.sh' %}
<reg>(cp -p "\$RC_LIBEXECDIR"/cache/\* "\$RC_SVCDIR" 2&gt;/dev/null
fi
)(
echo sysinit &gt;"\$RC_SVCDIR"/softlevel
exit)</reg>
<text>\1
rc-update -u
\2</text>

@ -0,0 +1 @@
{% calculate append='link', source='/proc/self/mounts', unbound %}

@ -0,0 +1,10 @@
{% calculate format='openrc' %}
#able to press the I key during boot so you can choose to start specific services
rc_interactive="NO"
#use all net.* for network atapters (need for CDS)
rc_parallel="YES"
{% if pkg('net-vpn/wireguard-tools') %}
rc_hotplug="!net.wg?"
{% else %}
rc_hotplug="*"
{% endif %}

@ -0,0 +1 @@
{% calculate append='remove', path='/etc/runlevels/boot', name='mtab' %}

@ -0,0 +1 @@
# Calculate mergepkg()!= append=skip

@ -0,0 +1 @@
{% calculate path='/usr/share/portage' %}

@ -0,0 +1,10 @@
{% calculate format='samba', name='repos.conf' %}
{% set repositories = update.cl.repositories %}
[gentoo]
sync-type = git
{% if repositories and repositories[0].name == 'gentoo' and repositories[0].url %}
sync-uri = {{ repositories[0].url }}
{% else %}
sync-uri = git://git.calculate-linux.org/calculate/gentoo-overlay.git
{% endif %}

@ -0,0 +1 @@
{% calculate format='samba', path='/etc/portage/repos.conf', name='gentoo.conf', source='/usr/share/portage/config/repos.conf', mirror, force %}

@ -0,0 +1 @@
{% calculate append='remove', path='/etc/porage/repos.conf' %}

@ -0,0 +1 @@
{% calculate append='remove', path='/etc/portage/make.conf', name='0-base' %}

@ -0,0 +1,38 @@
{% calculate run='/bin/bash' %}
for dn in /usr/lib*/python*/site-packages/portage/sync/modules
do
[[ -d $dn ]] || continue
[[ -d $dn/calculate ]] || mkdir -p $dn/calculate
cat >$dn/calculate/__init__.py <<EOF
# Copyright 2014-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
doc = """Calculate plug-in module for portage.
Performs a git pull on repositories."""
__doc__ = doc[:]
from portage.localization import _
from portage.sync.config_checks import CheckSyncConfig
from portage.util import writemsg_level
module_spec = {
'name': 'calcualte',
'description': doc,
'provides':{
'calculate-module': {
'name': "calculate",
'sourcefile': "calculate",
'class': "CalculateSync",
'description': doc,
'functions': ['sync'],
'func_desc': {
'sync': 'Performs a calculate overlay sychronization',
},
'validate_config': CheckSyncConfig,
}
}
}
EOF
done

@ -0,0 +1,57 @@
{% calculate run='/bin/bash' %}
for dn in /usr/lib*/python*/site-packages/portage/sync/modules
do
[[ -d $dn ]] || continue
[[ -d $dn/calculate ]] || mkdir -p $dn/calculate
cat >$dn/calculate/calculate.py <<EOF
# Copyright 2005-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import io
import logging
import subprocess
import portage
from portage import os
from portage.util import writemsg_level, shlex_split
from portage.util.futures import asyncio
from portage.output import create_color_func, EOutput
good = create_color_func("GOOD")
bad = create_color_func("BAD")
warn = create_color_func("WARN")
from portage.sync.syncbase import NewBase
class CalculateSync(NewBase):
'''Calculate sync class'''
short_desc = "Perform sync operations on calculate based repositories"
@staticmethod
def name():
return "CalculateSync"
def __init__(self):
NewBase.__init__(self, "cl-core", "sys-apps/calculate-utils")
def update(self):
"""
Internal function to update an existing calculate repository
@return: tuple of return code (0=success), whether the cache
needs to be updated
@rtype: (int, bool)
"""
#calculate update
exitcode = portage.process.spawn_bash(
"/usr/sbin/cl-core --method update --rep %s "
"--sync-only on --skip-eix-update -T none" % self.repo.name)
if exitcode != os.EX_OK:
msg = "!!! calculate update error; exiting."
self.logger(self.xterm_titles, msg)
writemsg_level(msg + "\n", noiselevel=-1, level=logging.ERROR)
return (exitcode, False)
EOF
done

@ -0,0 +1,5 @@
{% calculate format='contents' %}
sys-apps/portage /usr/lib/python*/site-packages/portage/sync/modules/calculate
sys-apps/portage /usr/lib/python*/site-packages/portage/sync/modules/calculate/*
sys-apps/portage /usr/lib64/python*/site-packages/portage/sync/modules/calculate
sys-apps/portage /usr/lib64/python*/site-packages/portage/sync/modules/calculate/*

@ -0,0 +1 @@
{% calculate append='skip', package='sys-apps/sandbox' %}

@ -0,0 +1 @@
{% calculate path='/usr/share/applications', append='remove' %}

@ -0,0 +1 @@
{% calculate append='skip', package='sys-apps/shadow' %}

@ -0,0 +1,13 @@
{% calculate format='regex', comment='#', path='/etc' %}
<reg>
ENV_SUPATH\tPATH=/sbin:/bin:/usr/sbin:/usr/bin
</reg>
<text>
ENV_SUPATH\tPATH=/usr/sbin:/usr/bin:/sbin:/bin
</text>
<reg>
ENV_PATH\tPATH=/bin:/usr/bin
</reg>
<text>
ENV_PATH\tPATH=/usr/bin:/bin
</text>

@ -0,0 +1,2 @@
{% calculate path='/etc', (not exists('/etc/subuid')), unbound %}
root:1000000:65536

@ -0,0 +1,2 @@
{% calculate path='/etc', (not exists('/etc/subuid')), unbound %}
root:1000000:65536

@ -0,0 +1 @@
{% calculate name='etc', package='sys-apps/sysvinit' %}

@ -0,0 +1,12 @@
{% calculate format='regex', comment='#' %}
<reg>(si::sysinit:/sbin/(?:open)?rc sysinit
)
(# Further system initialization, brings up the boot runlevel.)
([\s\S]+?)
([^\n]+tty2 linux[\s\S]+tty6 linux)</reg>
<text>\1
# TERMINALS
\4
\2
\3</text>
Loading…
Cancel
Save