Jump to content

lego12239

Members
  • Content Count

    7
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by lego12239

  1. Hi, all. Looking at nginx-1.17.5 ebuild src_install(). Can't understand why ${EROOT} is used instead of ${EPREFIX}.
  2. Hi, all. Can anybody explain why we need ${ED}? We already have ${D} and if somebody need, its value can be replaced with "${D}/${EPREFIX}" without entering ED. The same for EROOT vs ROOT.
  3. Hi, all. Am i understand correctly, that the difference between doins and newins only in the presence of second argument?
  4. user-uid.map can contain shell, homedir and groups in addition to uid. Thus, enewuser can derive all needed parameters from the map file(so, if many packages really need the same user, they can create it independently).
  5. Yes. acct-user/* and acct-group/* are ugly a little less than completely :-D.
  6. emap*() here - just a prototypes. imho, it should be implemented as small static C binary and included in the portage package.
  7. My considerations about "problem" with constant uid/gid between machines. Hope i understood correctly motivations from glep 81. If we need a constant uid/gid for some packages, then we need something like /etc/services for uid and gid. For example, /var/git/meta-repo/user-uid.map and /var/git/meta-repo/group-gid.map. Format of these files could be: user-uid.map: UNAME SP UID group-gid.map: GNAME SP GID Where: UNAME - user name GNAME - group name UID - user id GID - group id SP - spaces and/or tabs ([ \t]+) Then we should modify user.eclass a little. In such a way that enewuser and enewgroup must do 2 things: - consult these files for constant uid/gid(if, for example, -S is specified) - place package name which call enewgroup/enewuser in /var/lib/portage/group-pkg.map and /var/lib/portage/user-pkg.map respectively Example changes for enewgroup: --- user.eclass.orig 2020-05-06 09:27:19.264986735 +0000 +++ user.eclass 2020-05-06 16:09:38.664894650 +0000 @@ -262,6 +262,8 @@ # # If -F is passed, enewgroup will always enforce specified GID and fail if it # can not be assigned. +# If -S is passed, gid is got from group-gid.map; if -F is also passed and +# such user already exist with different gid, then enewgroup fail. enewgroup() { if [[ ${EUID} != 0 ]] ; then einfo "Insufficient privileges to execute ${FUNCNAME[0]}" @@ -269,10 +271,11 @@ fi _assert_pkg_ebuild_phase ${FUNCNAME} - local force_gid= + local force_gid= strict_gid= while [[ $1 == -* ]]; do case $1 in -F) force_gid=1;; + -S) strict_gid=1;; *) die "${FUNCNAME}: invalid option ${1}";; esac shift @@ -287,6 +290,12 @@ # see if group already exists if [[ -n $(egetent group "${egroup}") ]] ; then + local egid=$(emapget /var/git/meta-repo/group-gid.map ${egroup}) + if [[ -n ${strict_gid} && -n ${force_gid} && \ + $(egetent group "${egroup}" | cut -d: -f3) != ${egid} ]] ; then + die "${egroup} exist, but GID for ${egroup} group must be ${egid}" + fi + emapaddval /var/lib/portage/user-pkg.map ${egroup} ${PN} return 0 fi einfo "Adding group '${egroup}' to your system ..." @@ -294,6 +303,9 @@ # handle gid local egid=$1; shift if [[ ! -z ${egid} ]] ; then + if [[ -n ${strict_gid} ]] ; then + die "${FUNCNAME}: -S can't be specified with GID" + fi if [[ ${egid} -gt 0 ]] ; then if [[ -n $(egetent group ${egid}) ]] ; then [[ -n ${force_gid} ]] && die "${FUNCNAME}: GID ${egid} already taken" @@ -304,8 +316,16 @@ die "${egid} is not a valid GID" fi else - [[ -n ${force_gid} ]] && die "${FUNCNAME}: -F with gid==-1 makes no sense" - egid="next available" + if [[ -n ${strict_gid} ]] ; then + egid=$(emapget /var/git/meta-repo/group-gid.map ${egroup}) + if [[ -z ${egid} ]] ; then + die "${FUNCNAME}: group ${egroup} doesn't exist in /var/git/meta-repo/group-gid.map" + fi + elif [[ -n ${force_gid} ]] ; then + die "${FUNCNAME}: -F with gid==-1 makes no sense" + else + egid="next available" + fi fi einfo " - Groupid: ${egid}" @@ -349,6 +369,158 @@ groupadd -r ${opts} "${egroup}" || die ;; esac + emapaddval /var/lib/portage/user-pkg.map ${egroup} ${PN} +} + +emapget() { + local mapfile=$1 key=$2 + + # TODO: here must be a file lock + if [[ ! -f ${mapfile} ]]; then + return 0 + fi + awk -v key=$key ' + $1 == key { + values=$2 + for(i = 3; i <= NF; i++) { + values=values " " $i + } + print values + exit + }' ${mapfile} +} + +emapset() { + local mapfile=$1 key=$2 + shift 2 + local values="$@" + + # TODO: here must be a file lock + if [[ ! -f ${mapfile} ]]; then + touch ${mapfile} + fi + awk -v key=$key -v values="$values" ' + $1 != key { + print $0 + } + $1 == key { + is_found=1 + print key " " values + } + END { + if (!is_found) { + print key " " values + } + }' ${mapfile} > ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "emapset error: awk error" + fi + mv ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP ${mapfile} + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "emapset error: mv error" + fi +} + +emaprm() { + local mapfile=$1 key=$2 + + # TODO: here must be a file lock + if [[ ! -f ${mapfile} ]]; then + return 0 + fi + awk -v key=$key ' + $1 != key { + print $0 + }' ${mapfile} > $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP + if [[ $? -ne 0 ]] ; then + rm $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP + die "emaprm error: awk error" + fi + mv $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP ${mapfile} + if [[ $? -ne 0 ]] ; then + rm $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP + die "emaprm error: mv error" + fi +} + +emapaddval() { + local mapfile=$1 key=$2 + shift 2 + local values="$@" + + # TODO: here must be a file lock + if [[ ! -f ${mapfile} ]]; then + touch ${mapfile} + fi + awk -v key=$key -v values="$values" ' + $1 != key { + print $0 + } + $1 == key { + is_found = 1 + vtoadd = "" + n = split(values, vals) + for(i = 1; i <= n; i++) { + for(j = 2; j <= NF; j++) + if ($j == vals[i]) + break + if (j == (NF+1)) + vtoadd = vtoadd " " vals[i] + } + print $0 vtoadd + } + END { + if (!is_found) { + print key " " values + } + }' ${mapfile} > $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "${FUNCNAME}: awk error" + fi + mv $PORTAGE_TMPDIR/$(basename ${mapfile}).$$.TMP ${mapfile} + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "${FUNCNAME}: mv error" + fi +} + +emaprmval() { + local mapfile=$1 key=$2 + shift 2 + local values="$@" + + # TODO: here must be a file lock + if [[ ! -f ${mapfile} ]]; then + return 0 + fi + awk -v key=$key -v values="$values" ' + $1 != key { + print $0 + } + $1 == key { + vnew = "" + n = split(values, vals) + for(i = 2; i <= NF; i++) { + for(j = 1; j <= n; j++) + if ($i == vals[j]) + break + if (j == (n+1)) + vnew = vnew " " $i + } + print key vnew + }' ${mapfile} > ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "emaprmval error: awk error" + fi + mv ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP ${mapfile} + if [[ $? -ne 0 ]] ; then + rm ${PORTAGE_TMPDIR}/$(basename ${mapfile}).$$.TMP + die "emaprmval error: can't do mv" + fi } # @FUNCTION: egetusername After that we have info in /var/lib/portage/user-pkg.map and /var/lib/portage/group-pkg.map about what user/group is used by what packages. And can show this with equery module. If we see user/group without packages - this entry is orphaned. We can show this with a same equery module and give a user possibility to remove this with some ego module(something like "ego user cleanup" and "ego group cleanup").
  8. Hi, all. Is /var/git/ a right location to place custom overlay/kit (for example, /var/git/my)? Can i sure that it willn't be removed by ego/portage?
  9. $ equery l corenetwork * Searching for corenetwork ... [IP-] [ ] sys-apps/corenetwork-1.6.5:0 I have 1.6.5 version of corenetwork and there is nothing about virtfn. May be this changes aren't accessible yet.
  10. Hi. Show please your /etc/conf.d/net.test.
  11. Hi, all. Am only for me this seems strange? User/group management with packages is wrong, imho. If gentoo wants constant uid/gid for some daemons, why doesn't simply tell package maintainers to do this with enewuser/enewgroup? Why this strange idea?..
  12. You can't avoid systemd simply by installing openrc. Many binaries of systemd package can still be in a system. In funtoo you can easily do: epro mix-ins no-systemd In gentoo(when i tried it) this can't be done so easy. I didn't say that in gentoo net conf is complex, i said that funtoo do it better ;-).
  13. Gentoo doesn't allow easily eliminate systemd. Networking configuration in funtoo is better. The one thing annoying - i can't find in-system documentation for net stuff (man pages); and every time i configure nic, i need to go to /etc/netif.d/ to remember how parameters are written.
  14. I can, but i wan't :-). And funtoo give me this possibility to live as i want.
  15. Except other significant things, funtoo allow you to live without systemd. In our days this is very important.
  16. Bad colons. I've removed colons from mduuid and grub now boot the system without problems.
  17. Hi, all. May be anybody know an answer and i can save some time :-). If i do an external redirect in exim, what MAIL FROM is used exim in smtp connection to an external server? example /etc/aliases: me: me@gmail.com example email: MAIL FROM <somebody@his.server> RCPT TO <me@my.server> my.server redirect it to gmail according to aliases: MAIL FROM <?????> RCPT TO <me@gmail.com>
  18. Hi, all! My grub doesn't see mdraid (raid1) by mduuid. /boot/grub/grub.cfg: set timeout=2 menuentry 'Funtoo, 4.14.97' { insmod gzio insmod mdraid1x insmod part_msdos insmod ext2 set root='(mduuid/232d2317:1469bc36:e85fd34c:9136eb63,msdos1)' echo 'Loading kernel...' linux /boot/vmlinuz-4.14.97-nat root=LABEL=rootfs ro domdadm echo 'Loading initial ramdisk...' initrd /boot/initramfs-genkernel-x86_64-4.14.97-nat } If i replace "set root='(mduuid/232d2317:1469bc36:e85fd34c:9136eb63,msdos1)'" with "set root='(md/0,msdos1)'", then grub boot the system. Grub was installed with the next command(sda and sdb are raid component devices): grub-install --boot-directory=/boot/ --modules='part_msdos mdraid1x' /dev/sda grub-install --boot-directory=/boot/ --modules='part_msdos mdraid1x' /dev/sdb mdraid UUID: mdadm --detail /dev/md127 | grep UUID UUID : 232d2317:1469bc36:e85fd34c:9136eb63 How can i fix this?
  19. May be it's a time to go to plan9 and make it more usable for everyday use ;-).
  20. This is not linux, this is lindows :-). I can't understand why Poettering still haven't added to systemd registry and bsod...
  21. Hi, all! Why do we have both loopback and net.lo initscripts?
  22. Fixed by adding rm before ln in the ebuild.
  23. Some strange error when boost installing: >>> Install boost-1.65.0 into /var/tmp/portage/dev-libs/boost-1.65.0/image/ category dev-libs * abi_x86_64.amd64: running multilib-minimal_abi_src_install * python2_7: running installation * ACCESS DENIED: symlinkat: /var/tmp/portage/dev-libs/boost-1.65.0/temp/libpython2.7.so ln: failed to create symbolic link '/var/tmp/portage/dev-libs/boost-1.65.0/temp/libpython2.7.so': Permission denied * ERROR: dev-libs/boost-1.65.0::core-kit failed (install phase): * (no error message) * * Call stack: * ebuild.sh, line 92: Called src_install * environment, line 4402: Called multilib-minimal_src_install * environment, line 2544: Called multilib_foreach_abi 'multilib-minimal_abi_src_install' * environment, line 2738: Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_install' * environment, line 2443: Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_install' * environment, line 2441: Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_install' * environment, line 436: Called multilib-minimal_abi_src_install * environment, line 2534: Called multilib_src_install * environment, line 3049: Called python_foreach_impl 'installation' * environment, line 3817: Called multibuild_foreach_variant '_python_multibuild_wrapper' 'installation' * environment, line 2443: Called _multibuild_run '_python_multibuild_wrapper' 'installation' * environment, line 2441: Called _python_multibuild_wrapper 'installation' * environment, line 565: Called installation * environment, line 3007: Called create_user-config.jam * environment, line 917: Called die * The specific snippet of code: * ln -f -s "$(python_get_library_path)" "${T}/lib${EPYTHON}$(get_libname)" || die; * * If you need support, post the output of `emerge --info '=dev-libs/boost-1.65.0::core-kit'`, * the complete build log and the output of `emerge -pqv '=dev-libs/boost-1.65.0::core-kit'`. * The complete build log is located at '/var/tmp/portage/dev-libs/boost-1.65.0/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-libs/boost-1.65.0/temp/environment'. * Working directory: '/var/tmp/portage/dev-libs/boost-1.65.0/work/boost_1_65_0-abi_x86_64.amd64' * S: '/var/tmp/portage/dev-libs/boost-1.65.0/work/boost_1_65_0' * --------------------------- ACCESS VIOLATION SUMMARY --------------------------- * LOG FILE: "/var/log/sandbox/sandbox-30018.log" * VERSION 1.0 FORMAT: F - Function called FORMAT: S - Access Status FORMAT: P - Path as passed to function FORMAT: A - Absolute Path (not canonical) FORMAT: R - Canonical Path FORMAT: C - Command Line F: symlinkat S: deny P: /var/tmp/portage/dev-libs/boost-1.65.0/temp/libpython2.7.so A: /var/tmp/portage/dev-libs/boost-1.65.0/temp/libpython2.7.so R: /usr/lib64/libpython2.7.so.1.0 C: ln -f -s /usr/lib64/libpython2.7.so /var/tmp/portage/dev-libs/boost-1.65.0/temp/libpython2.7.so How can i fix it?
  24. It seems this isn't work as needed :-). But i try to play with settings again. Can we mirror the forum to mailing list like nginx do (post on the forum appear in the mailing list and vise versa)?
  25. Wow! This helped! Now emerge is working. Thank you!
×
×
  • Create New...