diff options
-rw-r--r-- | classes/base.bbclass | 26 | ||||
-rw-r--r-- | classes/debian.bbclass | 2 | ||||
-rw-r--r-- | classes/package.bbclass | 426 | ||||
-rw-r--r-- | classes/package_ipk.bbclass | 2 | ||||
-rw-r--r-- | classes/package_rpm.bbclass | 2 | ||||
-rw-r--r-- | classes/package_tar.bbclass | 2 | ||||
-rw-r--r-- | conf/machine/h3900.conf | 2 | ||||
-rw-r--r-- | packages/initscripts/initscripts-1.0/logicpd-pxa270/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/initscripts/initscripts-1.0/logicpd-pxa270/checkroot.sh | 179 | ||||
-rw-r--r-- | packages/initscripts/initscripts_1.0.bb | 2 |
10 files changed, 439 insertions, 204 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index 0e864457ab..eda1b23b04 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -575,7 +575,7 @@ do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${T ${STAGING_DATADIR} \ ${S} ${B}" -addtask populate_staging after do_package +addtask populate_staging after do_package_write python do_populate_staging () { bb.build.exec_func('do_stage', d) @@ -599,9 +599,6 @@ do_build[func] = "1" # Functions that update metadata based on files outputted # during the build process. -SHLIBS = "" -RDEPENDS_prepend = " ${SHLIBS}" - def explode_deps(s): r = [] l = s.split() @@ -619,27 +616,6 @@ def explode_deps(s): r.append(i) return r -python read_shlibdeps () { - packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() - for pkg in packages: - rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") - shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d) - if os.access(shlibsfile, os.R_OK): - fd = file(shlibsfile) - lines = fd.readlines() - fd.close() - for l in lines: - rdepends.append(l.rstrip()) - pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d) - if os.access(pcfile, os.R_OK): - fd = file(pcfile) - lines = fd.readlines() - fd.close() - for l in lines: - rdepends.append(l.rstrip()) - bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) -} - def read_pkgdatafile(fn): pkgdata = {} diff --git a/classes/debian.bbclass b/classes/debian.bbclass index 698d917b51..7ffa6c1a27 100644 --- a/classes/debian.bbclass +++ b/classes/debian.bbclass @@ -8,7 +8,7 @@ BUILD_ALL_DEPS = "1" # Better expressed as ensure all RDEPENDS package before we package # This means we can't have circular RDEPENDS/RRECOMMENDS -do_package[rdeptask] = "do_package" +do_package_write[rdeptask] = "do_package" python debian_package_name_hook () { import glob, copy, stat, errno, re diff --git a/classes/package.bbclass b/classes/package.bbclass index 7d3068852f..c70f08eefe 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -1,4 +1,11 @@ +# +# General packaging help functions +# + def legitimize_package_name(s): + """ + Make sure package names are legitimate strings + """ import re def fixutf(m): @@ -12,74 +19,11 @@ def legitimize_package_name(s): # Remaining package name validity fixes return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') -STAGING_PKGMAPS_DIR ?= "${STAGING_DIR}/pkgmaps" - -def add_package_mapping (pkg, new_name, d): - import bb, os - - def encode(str): - import codecs - c = codecs.getencoder("string_escape") - return c(str)[0] - - pmap_dir = bb.data.getVar('STAGING_PKGMAPS_DIR', d, 1) - - bb.mkdirhier(pmap_dir) - - data_file = os.path.join(pmap_dir, pkg) - - f = open(data_file, 'w') - f.write("%s\n" % encode(new_name)) - f.close() - -def get_package_mapping (pkg, d): - import bb, os - - def decode(str): - import codecs - c = codecs.getdecoder("string_escape") - return c(str)[0] - - data_file = bb.data.expand("${STAGING_PKGMAPS_DIR}/%s" % pkg, d) - - if os.access(data_file, os.R_OK): - f = file(data_file, 'r') - lines = f.readlines() - f.close() - for l in lines: - return decode(l).strip() - return pkg - -def runtime_mapping_rename (varname, d): - import bb, os - - #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) - - new_depends = [] - for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): - # Have to be careful with any version component of the depend - split_depend = depend.split(' (') - new_depend = get_package_mapping(split_depend[0].strip(), d) - if len(split_depend) > 1: - new_depends.append("%s (%s" % (new_depend, split_depend[1])) - else: - new_depends.append(new_depend) - - bb.data.setVar(varname, " ".join(new_depends) or None, d) - - #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) - -python package_mapping_rename_hook () { - runtime_mapping_rename("RDEPENDS", d) - runtime_mapping_rename("RRECOMMENDS", d) - runtime_mapping_rename("RSUGGESTS", d) - runtime_mapping_rename("RPROVIDES", d) - runtime_mapping_rename("RREPLACES", d) - runtime_mapping_rename("RCONFLICTS", d) -} - - def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None): + """ + Used in .bb files to split up dynamically generated subpackages of a + given package, usually plugins or modules. + """ import os, os.path, bb dvar = bb.data.getVar('D', d, 1) @@ -165,9 +109,6 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst bb.data.setVar('PACKAGES', ' '.join(packages), d) -# Function to strip a single file, called from RUNSTRIP below -# A working 'file' (one which works on the target architecture) -# is necessary for this stuff to work. PACKAGE_DEPENDS ?= "file-native" DEPENDS_prepend =+ "${PACKAGE_DEPENDS} " # file(1) output to match to consider a file an unstripped executable @@ -176,7 +117,12 @@ FILE_UNSTRIPPED_MATCH ?= "not stripped" IGNORE_STRIP_ERRORS ?= "1" runstrip() { + # Function to strip a single file, called from RUNSTRIP in populate_packages below + # A working 'file' (one which works on the target architecture) + # is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS + local ro st + st=0 if { file "$1" || { oewarn "file $1: failed (forced strip)" >&2 @@ -218,6 +164,128 @@ runstrip() { return $st } + +# +# Package data handling routines +# + +STAGING_PKGMAPS_DIR ?= "${STAGING_DIR}/pkgmaps" + +def add_package_mapping (pkg, new_name, d): + import bb, os + + def encode(str): + import codecs + c = codecs.getencoder("string_escape") + return c(str)[0] + + pmap_dir = bb.data.getVar('STAGING_PKGMAPS_DIR', d, 1) + + bb.mkdirhier(pmap_dir) + + data_file = os.path.join(pmap_dir, pkg) + + f = open(data_file, 'w') + f.write("%s\n" % encode(new_name)) + f.close() + +def get_package_mapping (pkg, d): + import bb, os + + def decode(str): + import codecs + c = codecs.getdecoder("string_escape") + return c(str)[0] + + data_file = bb.data.expand("${STAGING_PKGMAPS_DIR}/%s" % pkg, d) + + if os.access(data_file, os.R_OK): + f = file(data_file, 'r') + lines = f.readlines() + f.close() + for l in lines: + return decode(l).strip() + return pkg + +def runtime_mapping_rename (varname, d): + import bb, os + + #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) + + new_depends = [] + for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): + # Have to be careful with any version component of the depend + split_depend = depend.split(' (') + new_depend = get_package_mapping(split_depend[0].strip(), d) + if len(split_depend) > 1: + new_depends.append("%s (%s" % (new_depend, split_depend[1])) + else: + new_depends.append(new_depend) + + bb.data.setVar(varname, " ".join(new_depends) or None, d) + + #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) + +# +# Package functions suitable for inclusion in PACKAGEFUNCS +# + +python package_do_split_locales() { + import os + + if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): + bb.debug(1, "package requested not splitting locales") + return + + packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + if not packages: + bb.debug(1, "no packages to build; not splitting locales") + return + + datadir = bb.data.getVar('datadir', d, 1) + if not datadir: + bb.note("datadir not defined") + return + + dvar = bb.data.getVar('D', d, 1) + if not dvar: + bb.error("D not defined") + return + + pn = bb.data.getVar('PN', d, 1) + if not pn: + bb.error("PN not defined") + return + + if pn + '-locale' in packages: + packages.remove(pn + '-locale') + + localedir = os.path.join(dvar + datadir, 'locale') + + if not os.path.isdir(localedir): + bb.debug(1, "No locale files in this package") + return + + locales = os.listdir(localedir) + + mainpkg = packages[0] + + for l in locales: + ln = legitimize_package_name(l) + pkg = pn + '-locale-' + ln + packages.append(pkg) + bb.data.setVar('FILES_' + pkg, os.path.join(datadir, 'locale', l), d) + bb.data.setVar('RDEPENDS_' + pkg, '%s virtual-locale-%s' % (mainpkg, ln), d) + bb.data.setVar('RPROVIDES_' + pkg, '%s-locale %s-translation' % (pn, ln), d) + bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d) + + bb.data.setVar('PACKAGES', ' '.join(packages), d) + + rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split() + rdep.append('%s-locale*' % pn) + bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d) +} + python populate_packages () { import glob, stat, errno, re @@ -390,7 +458,10 @@ python populate_packages () { if found == False: bb.note("%s contains dangling symlink to %s" % (pkg, l)) bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) +} +populate_packages[dirs] = "${D}" +python emit_pkgdata() { def write_if_exists(f, pkg, var): def encode(str): import codecs @@ -401,17 +472,26 @@ python populate_packages () { if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) + packages = bb.data.getVar('PACKAGES', d, 1) + if not packages: + return + data_file = bb.data.expand("${STAGING_DIR}/pkgdata/${PN}", d) f = open(data_file, 'w') f.write("PACKAGES: %s\n" % packages) f.close() - for pkg in package_list: + for pkg in packages.split(): subdata_file = bb.data.expand("${STAGING_DIR}/pkgdata/runtime/%s" % pkg, d) sf = open(subdata_file, 'w') write_if_exists(sf, pkg, 'DESCRIPTION') write_if_exists(sf, pkg, 'RDEPENDS') write_if_exists(sf, pkg, 'RPROVIDES') + write_if_exists(sf, pkg, 'RRECOMMENDS') + write_if_exists(sf, pkg, 'RSUGGESTS') + write_if_exists(sf, pkg, 'RPROVIDES') + write_if_exists(sf, pkg, 'RREPLACES') + write_if_exists(sf, pkg, 'RCONFLICTS') write_if_exists(sf, pkg, 'PKG') write_if_exists(sf, pkg, 'ALLOW_EMPTY') write_if_exists(sf, pkg, 'FILES') @@ -420,8 +500,8 @@ python populate_packages () { write_if_exists(sf, pkg, 'pkg_preinst') write_if_exists(sf, pkg, 'pkg_prerm') sf.close() - bb.build.exec_func("read_subpackage_metadata", d) } +emit_pkgdata[dirs] = "${STAGING_DIR}/pkgdata/runtime" ldconfig_postinst_fragment() { if [ x"$D" = "x" ]; then @@ -429,58 +509,6 @@ if [ x"$D" = "x" ]; then fi } -python package_depchains() { - """ - For a given set of prefix and postfix modifiers, make those packages - RRECOMMENDS on the corresponding packages for its DEPENDS. - - Example: If package A depends upon package B, and A's .bb emits an - A-dev package, this would make A-dev Recommends: B-dev. - """ - - packages = bb.data.getVar('PACKAGES', d, 1) - postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() - prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() - - def pkg_addrrecs(pkg, base, func, d): - rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") - # bb.note('rdepends for %s is %s' % (base, rdepends)) - rreclist = [] - - for depend in rdepends: - split_depend = depend.split(' (') - name = split_depend[0].strip() - func(rreclist, name) - - oldrrec = bb.data.getVar('RRECOMMENDS_%s', d) or '' - bb.data.setVar('RRECOMMENDS_%s' % pkg, oldrrec + ' '.join(rreclist), d) - - def packaged(pkg, d): - return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) - - for pkg in packages.split(): - for postfix in postfixes: - def func(list, name): - pkg = '%s%s' % (name, postfix) - if packaged(pkg, d): - list.append(pkg) - - base = pkg[:-len(postfix)] - if pkg.endswith(postfix): - pkg_addrrecs(pkg, base, func, d) - continue - - for prefix in prefixes: - def func(list, name): - pkg = '%s%s' % (prefix, name) - if packaged(pkg, d): - list.append(pkg) - - base = pkg[len(prefix):] - if pkg.startswith(prefix): - pkg_addrrecs(pkg, base, func, d) -} - python package_do_shlibs() { import os, re, os.path @@ -730,74 +758,126 @@ python package_do_pkgconfig () { fd.close() } -python package_do_split_locales() { - import os - - if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'): - bb.debug(1, "package requested not splitting locales") - return - +python read_shlibdeps () { packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() - if not packages: - bb.debug(1, "no packages to build; not splitting locales") - return + for pkg in packages: + rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") + shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d) + if os.access(shlibsfile, os.R_OK): + fd = file(shlibsfile) + lines = fd.readlines() + fd.close() + for l in lines: + rdepends.append(l.rstrip()) + pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d) + if os.access(pcfile, os.R_OK): + fd = file(pcfile) + lines = fd.readlines() + fd.close() + for l in lines: + rdepends.append(l.rstrip()) + bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) +} - datadir = bb.data.getVar('datadir', d, 1) - if not datadir: - bb.note("datadir not defined") - return +python package_depchains() { + """ + For a given set of prefix and postfix modifiers, make those packages + RRECOMMENDS on the corresponding packages for its DEPENDS. - dvar = bb.data.getVar('D', d, 1) - if not dvar: - bb.error("D not defined") - return + Example: If package A depends upon package B, and A's .bb emits an + A-dev package, this would make A-dev Recommends: B-dev. + """ - pn = bb.data.getVar('PN', d, 1) - if not pn: - bb.error("PN not defined") - return + packages = bb.data.getVar('PACKAGES', d, 1) + postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split() + prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split() - if pn + '-locale' in packages: - packages.remove(pn + '-locale') + def pkg_addrrecs(pkg, base, func, d): + rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "") + # bb.note('rdepends for %s is %s' % (base, rdepends)) + rreclist = [] - localedir = os.path.join(dvar + datadir, 'locale') + for depend in rdepends: + split_depend = depend.split(' (') + name = split_depend[0].strip() + func(rreclist, name) - if not os.path.isdir(localedir): - bb.debug(1, "No locale files in this package") - return + bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d) - locales = os.listdir(localedir) + def packaged(pkg, d): + return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) - mainpkg = packages[0] + for pkg in packages.split(): + for postfix in postfixes: + def func(list, name): + pkg = '%s%s' % (name, postfix) + if packaged(pkg, d): + list.append(pkg) - for l in locales: - ln = legitimize_package_name(l) - pkg = pn + '-locale-' + ln - packages.append(pkg) - bb.data.setVar('FILES_' + pkg, os.path.join(datadir, 'locale', l), d) - bb.data.setVar('RDEPENDS_' + pkg, '%s virtual-locale-%s' % (mainpkg, ln), d) - bb.data.setVar('RPROVIDES_' + pkg, '%s-locale %s-translation' % (pn, ln), d) - bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d) + base = pkg[:-len(postfix)] + if pkg.endswith(postfix): + pkg_addrrecs(pkg, base, func, d) + continue - bb.data.setVar('PACKAGES', ' '.join(packages), d) + for prefix in prefixes: + def func(list, name): + pkg = '%s%s' % (prefix, name) + if packaged(pkg, d): + list.append(pkg) - rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split() - rdep.append('%s-locale*' % pn) - bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d) + base = pkg[len(prefix):] + if pkg.startswith(prefix): + pkg_addrrecs(pkg, base, func, d) } + PACKAGEFUNCS ?= "package_do_split_locales \ - populate_packages package_do_shlibs \ - package_do_pkgconfig read_shlibdeps \ - package_depchains" + populate_packages \ + package_do_shlibs \ + package_do_pkgconfig \ + read_shlibdeps \ + package_depchains \ + emit_pkgdata" + python package_do_package () { for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): bb.build.exec_func(f, d) } - -do_package[dirs] = "${D}" # shlibs requires any DEPENDS to have already packaged for the *.list files do_package[deptask] = "do_package" -populate_packages[dirs] = "${STAGING_DIR}/pkgdata/runtime ${D}" -EXPORT_FUNCTIONS do_package do_shlibs do_split_locales mapping_rename_hook +do_package[dirs] = "${D}" addtask package before do_build after do_install + + + +PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata" + +python package_do_package_write () { + for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split(): + bb.build.exec_func(f, d) +} +do_package_write[dirs] = "${D}" +addtask package_write before do_build after do_package + + +EXPORT_FUNCTIONS do_package do_package_write + + +# +# Helper functions for the package writing classes +# + +python package_mapping_rename_hook () { + """ + Rewrite variables to account for package renaming in things + like debian.bbclass or manual PKG variable name changes + """ + runtime_mapping_rename("RDEPENDS", d) + runtime_mapping_rename("RRECOMMENDS", d) + runtime_mapping_rename("RSUGGESTS", d) + runtime_mapping_rename("RPROVIDES", d) + runtime_mapping_rename("RREPLACES", d) + runtime_mapping_rename("RCONFLICTS", d) +} + +EXPORT_FUNCTIONS mapping_rename_hook diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index af6d905490..47cff1d27c 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -1,7 +1,7 @@ inherit package DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg" -PACKAGEFUNCS += "do_package_ipk" +PACKAGE_WRITE_FUNCS += "do_package_ipk" python package_ipk_fn () { from bb import data diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass index c29ab5f423..d5a1c8b379 100644 --- a/classes/package_rpm.bbclass +++ b/classes/package_rpm.bbclass @@ -2,7 +2,7 @@ inherit package inherit rpm_core RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}" -PACKAGEFUNCS += "do_package_rpm" +PACKAGE_WRITE_FUNCS += "do_package_rpm" python write_specfile() { from bb import data, build diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index 63e82f7f39..9217811e38 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,6 +1,6 @@ inherit package -PACKAGEFUNCS += "do_package_tar" +PACKAGE_WRITE_FUNCS += "do_package_tar" python package_tar_fn () { import os diff --git a/conf/machine/h3900.conf b/conf/machine/h3900.conf index 8c96ea71b8..0215d39912 100644 --- a/conf/machine/h3900.conf +++ b/conf/machine/h3900.conf @@ -34,4 +34,4 @@ USE_VT = "0" GUI_MACHINE_CLASS = "smallscreen" # not using tune-xscale so as to retain backwards compatibility -require conf/machine/tune-xscale.conf +require conf/machine/include/tune-xscale.conf diff --git a/packages/initscripts/initscripts-1.0/logicpd-pxa270/.mtn2git_empty b/packages/initscripts/initscripts-1.0/logicpd-pxa270/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/logicpd-pxa270/.mtn2git_empty diff --git a/packages/initscripts/initscripts-1.0/logicpd-pxa270/checkroot.sh b/packages/initscripts/initscripts-1.0/logicpd-pxa270/checkroot.sh new file mode 100644 index 0000000000..2a4d2a67a9 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/logicpd-pxa270/checkroot.sh @@ -0,0 +1,179 @@ +# +# checkroot.sh Check to root filesystem. +# +# Version: @(#)checkroot.sh 2.84 25-Jan-2002 miquels@cistron.nl +# + +. /etc/default/rcS + +# +# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned +# from this script *before anything else* with a timeout, like SCO does. +# +test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE + +# +# Ensure that bdflush (update) is running before any major I/O is +# performed (the following fsck is a good example of such activity :). +# +test -x /sbin/update && update + +# +# Read /etc/fstab. +# +exec 9>&0 </etc/fstab + +rootmode=rw +rootopts=rw +rootcheck=no +swap_on_md=no +devfs= +while read fs mnt type opts dump pass junk +do + case "$fs" in + ""|\#*) + continue; + ;; + /dev/md*) + # Swap on md device. + test "$type" = swap && swap_on_md=yes + ;; + /dev/*) + ;; + *) + # Might be a swapfile. + test "$type" = swap && swap_on_md=yes + ;; + esac + test "$type" = devfs && devfs="$fs" + test "$mnt" != / && continue + rootopts="$opts" + test "$pass" = 0 -o "$pass" = "" && rootcheck=no + case "$opts" in + ro|ro,*|*,ro|*,ro,*) + rootmode=ro + ;; + esac +done + +exec 0>&9 9>&- + + +# +# Activate the swap device(s) in /etc/fstab. This needs to be done +# before fsck, since fsck can be quite memory-hungry. +# +doswap=no +test -d /proc/1 || mount -n /proc + +case "`uname -r`" in + 2.[0123].*) + if test $swap_on_md = yes && grep -qs resync /proc/mdstat + then + test "$VERBOSE" != no && echo "Not activating swap - RAID array resyncing" + else + doswap=yes + fi + ;; + *) + doswap=yes + ;; +esac +if test $doswap = yes +then + test "$VERBOSE" != no && echo "Activating swap" + swapon -a 2> /dev/null +fi + +# +# Check the root filesystem. +# +if test -f /fastboot || test $rootcheck = no +then + test $rootcheck = yes && echo "Fast boot, no filesystem check" +else + # + # Ensure that root is quiescent and read-only before fsck'ing. + # + + mount -n -o remount,ro / + + if test $? = 0 + then + if test -f /forcefsck + then + force="-f" + else + force="" + fi + if test "$FSCKFIX" = yes + then + fix="-y" + else + fix="-a" + fi + spinner="-C" + case "$TERM" in + dumb|network|unknown|"") spinner="" ;; + esac + test `uname -m` = s390 && spinner="" # This should go away + test "$VERBOSE" != no && echo "Checking root filesystem..." + fsck $spinner $force $fix / + # + # If there was a failure, drop into single-user mode. + # + # NOTE: "failure" is defined as exiting with a return code of + # 2 or larger. A return code of 1 indicates that filesystem + # errors were corrected but that the boot may proceed. + # + if test "$?" -gt 1 + then + # Surprise! Re-directing from a HERE document (as in + # "cat << EOF") won't work, because the root is read-only. + echo + echo "fsck failed. Please repair manually and reboot. Please note" + echo "that the root filesystem is currently mounted read-only. To" + echo "remount it read-write:" + echo + echo " # mount -n -o remount,rw /" + echo + echo "CONTROL-D will exit from this shell and REBOOT the system." + echo + # Start a single user shell on the console + /sbin/sulogin $CONSOLE + reboot -f + fi + else + echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!" + echo + fi +fi + +# +# If the root filesystem was not marked as read-only in /etc/fstab, +# remount the rootfs rw but do not try to change mtab because it +# is on a ro fs until the remount succeeded. Then clean up old mtabs +# and finally write the new mtab. +# This part is only needed if the rootfs was mounted ro. +# + +if [ $(grep "/dev/root" /proc/mounts | awk '{print $4}') = rw ]; then + exit 0 +fi + +echo "Remounting root file system..." +mount -n -o remount,$rootmode / + +if test "$rootmode" = rw +then + if test ! -L /etc/mtab + then + rm -f /etc/mtab~ /etc/nologin + : > /etc/mtab + fi + mount -f -o remount / + mount -f /proc + test "$devfs" && grep -q '^devfs /dev' /proc/mounts && mount -f "$devfs" +fi + +: exit 0 diff --git a/packages/initscripts/initscripts_1.0.bb b/packages/initscripts/initscripts_1.0.bb index c1224b196a..928caae19d 100644 --- a/packages/initscripts/initscripts_1.0.bb +++ b/packages/initscripts/initscripts_1.0.bb @@ -5,7 +5,7 @@ DEPENDS = "makedevs" DEPENDS_openzaurus = "makedevs virtual/kernel" RDEPENDS = "makedevs" LICENSE = "GPL" -PR = "r75" +PR = "r76" SRC_URI = "file://halt \ file://ramdisk \ |