Skip to content
Browse files

FL-166: baselayout, really sync /etc/fstab with installation guide

  • Loading branch information...
1 parent b07f6fd commit 78a39bef72bb1e6647f4521bf84cfad1be6495ee @angryvincent angryvincent committed Jan 3, 2013
Showing with 278 additions and 0 deletions.
  1. +1 −0 sys-apps/baselayout/Manifest
  2. +277 −0 sys-apps/baselayout/baselayout-2.2.0-r4.ebuild
View
1 sys-apps/baselayout/Manifest
@@ -2,5 +2,6 @@ DIST baselayout-2.1.8-r3.tar.gz 24140 SHA256 2de70f3a1b6a6141741e58c4a53232e4a4c
DIST baselayout-2.1.8.tar.bz2 22782 SHA256 4a5c68cc8b190fd2fbf2c9cfc058dc9790c10fce7a3904ba0cc4fd756f6e3e53
DIST baselayout-2.2.0-r1.tar.gz 24089 SHA256 f339628330242b27cfdff7a0a36a3c83ab7a23bf81928469e66dc022ed04fbb8 SHA512 68c7191b80b87bcf0c6abb52cd2a52b1c90d9a74f8b473f38f06cae73fd7a9c326161b283368d8c718a9c5d911cebdf11e67d3b8adfd3ea18cbd4f6ee9eb8725 WHIRLPOOL e87d7b5e8b0e2ff9a1c759e20b1395ab2b85272fecca921b9ac91c601377751d94a5b95dc5cd4e550e66f2318ce5e68897f223bc36c8d6908c2441cadbe0bb2f
DIST baselayout-2.2.0-r3.tar.gz 23688 SHA256 1977aa62aab4efaf3ec0dd1f2d11df2b9472d7438a8405ff711c2d45e7502dfb SHA512 02b0727055976b17c220a9d1768f6f33742f4c2f5c50fc96fbe17d9f47739f7f4072b7dc1974d21a54c5543962142195e5cd2f1bfd8ed4413520c97efbdd7ea8 WHIRLPOOL 4c36bf6b38ce513e4b8ffceb92db9c17fdec09a0b89042b8608ccc0d859e28ef992461ba7334e13ea644137ae26db4fdc1d22985786bbedbe193696ca58ba4cb
+DIST baselayout-2.2.0-r4.tar.gz 23682 SHA256 3a609e046b0039e9bf0a844afa35449d0602431cca70a79d07a7fa89236047d2 SHA512 fd221728b3e90807041b006134146bd1ea5f4b013a38d2167da768bfa2f7951913c68fd337762874b18bac8c30843e617908a9caa2f4147840fa712d3f7a8adc WHIRLPOOL fd5ec51a1f1935530c02842cba14bc82101bacf0670b5540ce0f51e842c1f6289ece1a0be0da2d8fd32170f5a9ad33d7e59411e91fea86e11f1e3f26e72510eb
DIST baselayout-2.2.0.tar.gz 23696 SHA256 b1b3ffca7c4b840a1c1509cc731001cd67f72b9cd6fcc20086569e6afa751ddf
DIST realdev-1.0.tar.bz2 2171 SHA256 2173eff1afc883e6e42f51087bd0d6a3035faaaa3c93a4f8f5ddcc49f8b8aaa3 SHA512 6b4ef0e4b50bfdd5b759e7a94f570cb91d7298c80a223a901bf00f3e797ef01c68c0040e1f679bb4f892c5796a2185308b18d4b0da79319b03bbdc9220cb1c22 WHIRLPOOL e59ee3226d526fc8436fb1e654ce98e8fbc6ae578d169b3e1c75347ebd1c64d17caf8b95cf9c45fb88400295f1d8c7d2dde3b3438cdb8aba2ec132194db48902
View
277 sys-apps/baselayout/baselayout-2.2.0-r4.ebuild
@@ -0,0 +1,277 @@
+# Distributed under the terms of the GNU General Public License v2
+EAPI="4"
+
+inherit multilib
+
+DESCRIPTION="Filesystem baselayout, initscripts and /sbin/realdev command"
+HOMEPAGE="http://www.funtoo.org/"
+GITHUB_REPO="baselayout"
+GITHUB_USER="funtoo"
+GITHUB_TAG="baselayout-2.2.0-r4"
+SRC_URI="https://www.github.com/${GITHUB_USER}/${GITHUB_REPO}/tarball/${GITHUB_TAG} -> ${GITHUB_TAG}.tar.gz
+http://www.funtoo.org/archive/realdev/realdev-1.0.tar.bz2"
+S=$WORKDIR/$GITHUB_TAG
+S2=$WORKDIR/realdev-1.0
+
+LICENSE="GPL-2 BSD-2"
+SLOT="0"
+KEYWORDS="*"
+IUSE="build"
+PDEPEND="sys-apps/openrc"
+
+src_unpack() {
+ unpack ${A}
+ mv "${WORKDIR}/${GITHUB_USER}-${PN}"-??????? "${S}" || die
+
+}
+
+pkg_preinst() {
+ # execute critical sub-functions (defined elsewhere in this ebuild):
+ # migrate to new modules.conf filenames:
+ modfix
+
+ # create initial set of library directories if appropriate:
+
+ create_lib_dirs
+}
+
+create_lib_dirs() {
+ # Only do this for non-root filesystems. Also note that all filesystem-
+ # modifying commands below will only execute if the target file does
+ # not already exist. This should provide reasonable protection for existing
+ # installations that may differ from these norms.
+
+ [ "$ROOT" = "/" ] && return 0
+
+ # Get a list of libdirs for this ABI. For amd64, this list would be
+ # "lib lib64 lib32".
+
+ local libdirs="$(get_all_libdirs)" dir=
+
+ # This following shell construction will set $libdirs to "lib" if it
+ # is blank:
+
+ : ${libdirs:=lib}
+
+ # Now, we iterate over our lib dirs, creating one in /, /usr and
+ # /usr/local:
+
+ for dir in ${libdirs}
+ do
+ # If SYMLINK_LIB is set, this means that the "lib" dirs should be
+ # created as symlinks, so don't create real "lib" dirs in this case.
+ # For example, on amd64 multilib (the default,) SYMLINK_LIB is set to
+ # "yes" which means that /lib, /usr/lib and /usr/local/lib are symlinks
+ # to "lib64" (in the current directory.) We will create these symlinks
+ # as necessary later.
+
+ [ "$dir" = "lib" ] && [ "$SYMLINK_LIB" = "yes" ] && continue
+
+ [ -e ${ROOT}${dir} ] || install -d ${ROOT}${dir} || die
+ [ -e ${ROOT}usr/${dir} ] || install -d ${ROOT}usr/${dir} || die
+ [ -e ${ROOT}usr/local${dir} ] || install -d ${ROOT}usr/local/${dir} || die
+ done
+
+ # if SYMLINK_LIB is set, we are going to create "lib" symlinks pointing
+ # to the libdir for the DEFAULT_ABI (this would be "lib64" for an arch
+ # of amd64:
+
+ if [ "$SYMLINK_LIB" = "yes" ]
+ then
+ dir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ # If the "lib" target doesn't exist, then create a "lib" link
+ # pointing to something like "lib64" (libdir of the DEFAULT_ABI)
+ [ -e ${ROOT}lib ] || ln -sf ${dir} ${ROOT}lib || die
+ [ -e ${ROOT}usr/lib ] || ln -sf ${dir} ${ROOT}usr/lib || die
+ [ -e ${ROOT}usr/local/lib ] || ln -sf ${dir} ${ROOT}usr/local/lib || die
+ fi
+
+ # At this point, we should have a correctly-configured base set of library
+ # directories.
+}
+
+src_compile() {
+ return 0
+}
+
+modfix() {
+ local mod
+
+ # We want to move any old modprobe.d conf files that were installed by
+ # earlier baselayouts to the new file name so that config file protection
+ # works correctly when we merge the "new style" filenames.
+
+ for mod in i386 aliases
+ do
+ if [ -e $ROOT/etc/modprobe.d/$mod ]
+ then
+ mv $ROOT/etc/modprobe.d/$mod $ROOT/etc/modprobe.d/${mod}.conf || die "mv failed"
+ fi
+ done
+}
+
+src_install() {
+
+ cd $S2 || die
+ into /
+ dosbin realdev
+
+ cd $S || die
+
+ local libdir="lib"
+ local rcscripts_dir="/lib/rcscripts"
+
+ if [ ${SYMLINK_LIB} == "yes" ]; then
+ libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+ rcscripts_dir="/${libdir}/rcscripts"
+ fi
+ dodir /etc /usr/share/baselayout
+ cp -pPR etc/* etc.Linux/* ${D}/etc/ || die
+ cp -pPR share.Linux/* ${D}/usr/share/baselayout || die
+
+ einfo "Creating directories..."
+
+ keepdir /usr
+ keepdir /usr/local
+ keepdir /boot
+ keepdir /etc/conf.d
+ keepdir /etc/cron.daily
+ keepdir /etc/cron.hourly
+ keepdir /etc/cron.monthly
+ keepdir /etc/cron.weekly
+ keepdir /etc/env.d
+ keepdir /etc/modules.autoload.d
+ keepdir /etc/modules.d
+ keepdir /etc/opt
+ keepdir /etc/profile.d
+ keepdir /etc/portage
+ keepdir /home
+ keepdir ${rcscripts_dir}
+ keepdir /mnt
+ keepdir /mnt/cdrom
+ keepdir /mnt/floppy
+ keepdir /opt
+ keepdir /sbin
+ keepdir /usr/bin
+ keepdir /usr/include
+ keepdir /usr/include/asm
+ keepdir /usr/include/linux
+ keepdir /usr/local/bin
+ keepdir /usr/local/games
+ keepdir /usr/local/sbin
+ keepdir /usr/local/share
+ keepdir /usr/local/share/doc
+
+ keepdir /usr/local/share/man
+ dosym /usr/share/man /usr/local/share/man
+
+ keepdir /usr/local/src
+ keepdir /usr/sbin
+ keepdir /usr/share/doc
+ keepdir /usr/share/info
+ keepdir /usr/share/man
+ keepdir /usr/share/misc
+ keepdir /usr/src
+
+ keepdir /var
+
+ keepdir /var/adm
+ keepdir /var/spool/lpd
+ keepdir /var/spool/news
+ keepdir /var/spool/uucp
+
+ keepdir /var/db/pkg
+ keepdir /var/empty
+ keepdir /var/lib/misc
+ keepdir /var/lock/subsys
+ keepdir /var/log/news
+ keepdir /var/run
+ keepdir /var/spool
+ keepdir /var/state
+ keepdir /run
+
+ diropts -m 1777
+ keepdir /tmp /var/tmp
+
+ diropts -o root -g uucp -m0775 /var/lock
+ keepdir /var/lock
+
+ diropts -m0700
+ keepdir /root
+ insinto /root
+
+ dodoc ChangeLog
+
+ into /
+ dosbin "${FILESDIR}/MAKEDEV"
+ dosym ../../sbin/MAKEDEV /usr/sbin/MAKEDEV
+
+ # The following code generates an /etc/env.d/04multilib file for
+ # multilib profiles which contain default settings for all library
+ # paths to search. Note that currently, "/lib", "/usr/lib" and
+ # "/usr/local/lib" is on this list, which may not be necessary
+ # is SYMLINK_LIB is set in the profile. If possible, this should
+ # be tweaked/simplified:
+
+ if has_multilib_profile || [ $(get_libdir) != "lib" -o -n "${CONF_MULTILIBDIR}" ]; then
+ local libdirs="$(get_all_libdirs)" libdirs_env= dir=
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+ for dir in ${libdirs}; do
+ libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+ done
+
+ # Special-case uglyness... For people updating from lib32 -> lib amd64
+ # profiles, keep lib32 in the search path while it's around
+ if has_multilib_profile && [ -d "${ROOT}"lib32 -o -d "${ROOT}"lib32 ] && ! hasq lib32 ${libdirs}; then
+ libdirs_env="${libdirs_env}:/lib32:/usr/lib32:/usr/local/lib32"
+ fi
+ echo "LDPATH=\"${libdirs_env}\"" > "${T}"/04multilib
+ doenvd "${T}"/04multilib
+ fi
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Funtoo Linux - baselayout ${PV}" > "${D}"/etc/gentoo-release
+}
+
+pkg_postinst() {
+
+ # create some directories that will fail on merge due to .keep files. Once
+ # Portage has deprecated .keep files, this stuff can be moved back to
+ # src_install:
+
+ local x
+
+ for x in proc sys dev dev/pts
+ do
+ [ ! -d ${ROOT}${x} ] && install -d ${ROOT}${x}
+ done
+
+ [ ! -d ${ROOT}dev/shm ] && install -d ${ROOT}dev/shm
+
+ # openrc requires /run
+ [ ! -d ${ROOT}run ] && install -d ${ROOT}run
+
+
+ # templates installed to /usr/share/baselayout and copied into place if they
+ # don't exist in /etc.
+
+ for x in master.passwd passwd shadow group fstab ; do
+ [ -e "${ROOT}etc/${x}" ] && continue
+ [ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+ cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+ done
+
+ # carefully set perms for shadow to prevent non-root users from viewing
+ # encrypted password files.
+
+ for x in shadow ; do
+ [ -e "${ROOT}etc/${x}" ] && chmod 0600 "${ROOT}etc/$x"
+ done
+
+ # create minimal set of device nodes required for boot, if they do not
+ # already exist. We have a separate /sbin/realdev script for this, which
+ # is installed by this ebuild.
+
+ "$ROOT"/sbin/realdev $ROOT/dev
+}

0 comments on commit 78a39be

Please sign in to comment.
Something went wrong with that request. Please try again.