summaryrefslogtreecommitdiffstats
path: root/meta/packages/initscripts/initscripts-1.0/checkroot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/initscripts/initscripts-1.0/checkroot.sh')
-rwxr-xr-xmeta/packages/initscripts/initscripts-1.0/checkroot.sh165
1 files changed, 165 insertions, 0 deletions
diff --git a/meta/packages/initscripts/initscripts-1.0/checkroot.sh b/meta/packages/initscripts/initscripts-1.0/checkroot.sh
new file mode 100755
index 0000000000..8255038c32
--- /dev/null
+++ b/meta/packages/initscripts/initscripts-1.0/checkroot.sh
@@ -0,0 +1,165 @@
+#
+# 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.
+#
+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
hlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
SUMMARY = "A daemon for managing internet connections within embedded devices"
DESCRIPTION = "The ConnMan project provides a daemon for managing \
internet connections within embedded devices running the Linux \
operating system.  The Connection Manager is designed to be slim and \
to use as few resources as possible, so it can be easily integrated. \
It is a fully modular system that can be extended, through plug-ins, \
to support all kinds of wired or wireless technologies. Also, \
configuration methods, like DHCP and domain name resolving, are \
implemented using plug-ins."
HOMEPAGE = "http://connman.net/"
BUGTRACKER = "http://bugs.meego.com/buglist.cgi?quicksearch=connman"
LICENSE  = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
                    file://src/main.c;beginline=1;endline=20;md5=d6a1ac98a6791c5294e8a7f176ecd66d"

# we need to define the depends here, the dynamic stuff is too late
DEPENDS  = "dbus glib-2.0 ppp iptables gnutls \
            ${@base_contains('DISTRO_FEATURES', 'bluetooth','bluez4', '', d)} \
            ${@base_contains('DISTRO_FEATURES', 'wifi','wpa-supplicant', '', d)} \
            ${@base_contains('DISTRO_FEATURES', '3g','ofono', '', d)} \
            "

INC_PR = "r17"

TIST = "--enable-tist"
TIST_powerpc = ""

EXTRA_OECONF += "\
    ac_cv_path_WPASUPPLICANT=${sbindir}/wpa_supplicant \
    ac_cv_path_PPPD=${sbindir}/pppd \
    --enable-debug \
    --enable-threads \
    --enable-loopback \
    --enable-ethernet \
    ${@base_contains('DISTRO_FEATURES', 'wifi','--enable-wifi ${TIST}', '--disable-wifi', d)} \
    ${@base_contains('DISTRO_FEATURES', 'bluetooth','--enable-bluetooth ${TIST}', '--disable-bluetooth', d)} \
    ${@base_contains('DISTRO_FEATURES', '3g', '', '--disable-ofono', d)} \
    --enable-tools \
    --enable-test \
    --disable-polkit \
    --disable-client \
    --enable-fake \
"

INITSCRIPT_NAME = "connman"
INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."

# IMPORTANT: because xuser is shared with rootless X, please make sure the
# USERADD_PARAM is in sync with the one in xserver-nodm-init.bb
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "--create-home \
                       --groups video,tty,audio \
                       --user-group xuser"

inherit autotools gtk-doc pkgconfig update-rc.d useradd

# This allows *everyone* to access ConnMan over DBus, without any access
# control.  Really the at_console flag should work, which would mean that
# both this and the xuser patch can be dropped.
do_compile_append() {
	sed -i -e s:deny:allow:g src/connman-dbus.conf
}

do_install_append() {
	install -d ${D}${sysconfdir}/init.d
	install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman

	install -d ${D}${bindir}
	install -m 0755 ${S}/tools/*-test ${D}${bindir}
	install -m 0755 ${S}/tools/wispr ${D}${bindir}

	# We don't need to package an empty directory
	rmdir ${D}${libdir}/connman/scripts

	# Automake 1.12 won't install empty directories, but we need the
	# plugins directory to be present for ownership
	mkdir -p ${D}${libdir}/connman/plugins
}

# These used to be plugins, but now they are core
RPROVIDES_${PN} = "\
	connman-plugin-loopback \
	connman-plugin-ethernet \
	${@base_contains('DISTRO_FEATURES', 'bluetooth','connman-plugin-bluetooth', '', d)} \
	${@base_contains('DISTRO_FEATURES', 'wifi','connman-plugin-wifi', '', d)} \
	${@base_contains('DISTRO_FEATURES', '3g','connman-plugin-ofono', '', d)} \
	"

RDEPENDS_${PN} = "\
	dbus \
	${@base_contains('DISTRO_FEATURES', 'bluetooth', 'bluez4', '', d)} \
	${@base_contains('DISTRO_FEATURES', 'wifi','wpa-supplicant', '', d)} \
	${@base_contains('DISTRO_FEATURES', '3g','ofono', '', d)} \
	"

PACKAGES_DYNAMIC = "${PN}-plugin-*"

python populate_packages_prepend() {
    depmap = dict(pppd="ppp")
    packages = []
    multilib_prefix = (d.getVar("MLPREFIX", True) or "")
    hook = lambda file,pkg,b,c,d:packages.append((file,pkg))
    plugin_dir = d.expand('${libdir}/connman/plugins/')
    plugin_name = d.expand('${PN}-plugin-%s')
    do_split_packages(d, plugin_dir, '^(.*).so$', plugin_name, '${PN} plugin for %s', extra_depends='', hook=hook, prepend=True )
    for (file, package) in packages:
        plugintype = package.split( '-' )[-1]
        if plugintype in depmap:
            rdepends = map(lambda x: multilib_prefix + x,  depmap[plugintype].split())
            bb.note( "Adding rdependency on %s to %s" % ( rdepends, package ) )
            d.setVar("RDEPENDS_%s" % package, " ".join(rdepends))
}

PACKAGES =+ "${PN}-tools ${PN}-tests"

FILES_${PN}-tools = "${bindir}/wispr"

FILES_${PN}-tests = "${bindir}/*-test ${libdir}/${BPN}/test/*"
RDEPENDS_${PN}-tests = "python-dbus python-pygobject python-textutils python-subprocess python-fcntl python-netclient"

FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
            ${libdir}/connman/plugins \
            ${sysconfdir} ${sharedstatedir} ${localstatedir} \
            ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
            ${datadir}/dbus-1/system-services/*"

FILES_${PN}-dbg += "${libdir}/connman/*/.debug"

FILES_${PN}-dev += "${libdir}/connman/*/*.la"