Commit graph

55 commits

Author SHA1 Message Date
Stephen Smalley
0e23fee505 Change setsebool syntax to be consistent with other init built-ins.
Change setsebool syntax from name=value to name value.
This is to make it consistent with setprop and similar commands.
Update both the init built-in command and the toolbox command
for consistency.

Change-Id: I2c8e016ba26731c4a2ad4a49ae3b89362bf8f8a8
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-12-13 15:41:53 -05:00
Kenny Root
2a36ae5608 am 7b88a90d: Merge "Remove HAVE_SELINUX guards"
* commit '7b88a90da2a27e347fc16c14fa577f4ae1ef07fd':
  Remove HAVE_SELINUX guards
2012-10-17 09:57:10 -07:00
Kenny Root
b5982bf7c6 Remove HAVE_SELINUX guards
Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
2012-10-16 23:18:18 -07:00
Jean-Baptiste Queru
c3a4a054a9 am 3af04b71: am 7c386a61: Merge "Extend and document the "wait" command"
* commit '3af04b71e51e89af02a1fe526e4fc32dce0100d3':
  Extend and document the "wait" command
2012-08-20 10:29:38 -07:00
Jean-Baptiste Queru
7c386a610d Merge "Extend and document the "wait" command" 2012-08-20 09:18:38 -07:00
Benoit Goby
5c8574b512 init: Fix mkdir command when using ISUID or ISGID bit
On first boot, the directory is created with root:root ownership and
then chowned. chown clears the ISUID and ISGID bits, so we need to chmod
the directory again after chown.

Change-Id: I02dfe7a19a637678256b4e7cc09e6b5431e6f11e
2012-08-14 15:51:44 -07:00
Jeff Sharkey
e50ac5f777 Support shared-subtree and bind mount flags.
Bug: 6925012
Change-Id: Id8d887d17c6b1b2f90cfd1a1de991ccaba730b7d
2012-08-14 12:38:14 -07:00
Jean-Baptiste Queru
ef3f7fa32b Merge "Set the SELinux security label on new directories." 2012-08-08 13:42:20 -07:00
Stephen Smalley
e096e36e50 Set the SELinux security label on new directories.
Automatically set the SELinux security label on directories created
by init.rc.  This avoids the need to separately call restorecon on
each such directory from the init.rc file.  Also restorecon /dev
and /dev/socket after initial policy load so that they are labeled
correctly before any other dev nodes or sockets are created.

Change-Id: If6af6c4887cdead949737cebdd673957e9273ead
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-07-26 09:01:22 -04:00
Patrick McCormick
96d0a4dda8 Extend and document the "wait" command
The wait command was currently implemented but
undocumented and only used internally. This change
adds a second option toi (optionally) override the default
timeout of 5 seconds.

The wait command can be used to wait for a file to appear
during the boot process, for example a disk or other device,
and is a better alternative than an unconditional sleep.

Change-Id: Ia11d8419c0ea84deec0e1bf5adfca5bc76ff38b7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-24 10:31:49 -07:00
Benoit Goby
93574c619c init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-05-04 16:29:41 -07:00
Geremy Condra
42a9349dc4 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-05-02 11:13:49 -07:00
Ken Sumrall
048cc27c8a am 0e9dd90a: Change init to use libfs_mgr to mount filesystems.
* commit '0e9dd90ac336278659477cad0b9e9f1004e2b338':
  Change init to use libfs_mgr to mount filesystems.
2012-05-01 14:01:13 -07:00
Ken Sumrall
0e9dd90ac3 Change init to use libfs_mgr to mount filesystems.
The new fs_mgr library moves much of the knowledge of what filesystems
to mount into a new fstab.<device> file, and just calls one function to
mount all the filesystems.

Change-Id: If3db37530a0676000cba3e679db27aca734227e5
2012-05-01 13:14:27 -07:00
Colin Cross
cf41769375 am 64753635: am a02ff986: Merge "init: Add noexec mount option"
* commit '647536359f8ea63330805cb77abbf2f101952daa':
  init: Add noexec mount option
2012-04-27 00:21:22 -07:00
Lars Svensson
b6ee25e3ad init: Add noexec mount option
Change-Id: Ic13d66797a86d38432e79af0c3387ce986d0a19f
2012-04-23 13:27:48 -07:00
Benoit Goby
5890301308 init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-03-28 18:24:08 -07:00
Geremy Condra
9ed1fe7732 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-03-21 15:13:08 -07:00
Stephen Smalley
e46f9d510d Extend init and ueventd for SE Android.
Add SE Android support for init and ueventd.

init:
- Load policy at boot.
- Set the security context for service daemons and their sockets.
- New built-in commands: setcon, setenforce, restorecon, setsebool.
- New option for services: seclabel.

ueventd:
- Set the security context for device directories and nodes.

Change-Id: I98ed752cde503c94d99dfa5b5a47e3c33db16aac
2012-02-01 07:49:08 -05:00
Dima Zavin
84bf9af758 init: use init's property expansion code for setprop/write
Change-Id: I3c284860cc8d5106ac2b086e62baeb6263873935
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:09 -08:00
Dima Zavin
8f91282ebe init/cutils: move kernel logging interface to libcutils from init
Change-Id: Ia0f91b1fcd6cae69d76bf3dd841340958db938a8
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:17 -07:00
Chia-chi Yeh
27164dce5f init: make "mkdir" work even when the directory already exists.
This allows us to change permissions and ownerships of directories
in init scripts without adding additional commands.

Change-Id: I1815d6015953035251b98f28c0f3efd3c7f25f80
2011-07-08 16:06:56 -07:00
Mike Lockwood
1f0bd32f90 init: Add support for assigning system properties to system properties in init.rc
For example:
    setprop sys.usb.config $persist.sys.usb.config

Change-Id: I7b4e1ed1335906b32621bd96a341b0f94bbee7f5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:54 -07:00
Mike Lockwood
f5cb5b2435 init: Fix the init.rc import command
Change-Id: I8a91c3f7d1ca31e137d9043bb7f56e4a44fb63df
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:47 -07:00
Mike Lockwood
2c4d5dc415 init: Add support for writing system property value to a file in init.rc
The write command will write a property value if the value starts with a "$'

For example:
    write /sys/class/android_usb/iSerial $ro.serialno

Use double leading '$' if you need to write a string that starts with '$':

    write /data/foo $$hello

to write "$hello" to /data/foo

Change-Id: I55431ac7715a5347bb95c3a15aee97c575444dde
2011-06-09 15:42:31 -07:00
Ken Sumrall
7bc6e9ebe4 Teach the mount command in init to not consider a wiped partition to be encrypted.
Change-Id: I3e989f0b81ec35084baddc04e014406f4d90ce04
2011-05-26 20:01:39 -07:00
Ken Sumrall
c5c51033c8 Load the persistent properties after decrypting the /data partition
Fix for bug 3415286.  The persistent properties are normally read early
in the boot process after /data is mounted.  However, for an encrypted
system, at that point /data is a tmpfs ramdisk.  This change adds a new
command to init (load_persist_props) to read the persistent properties,
and adds an action to init.rc to load the persistent properties.  This
action is triggered by setting a property in vold, but that's in a
different CL.

Change-Id: I74b3057974ee6029c29d956b76fef5566700d471
2011-03-10 18:12:19 -08:00
Ken Sumrall
dd4d786cbf Fix for bug 3379244, non-eMMC devices don't start all services.
Fix for non-eMMC based devices to properly start the "on nonencrypted"
action.

Change-Id: I5d2966db352b02f1a1724fb105e1cefc46037e42
2011-02-17 18:09:47 -08:00
Ken Sumrall
203bad597f Add the commands rm and rmdir to init.
rm only removes a single non-directory directory entry (no -r support)
rmdir removes a single empty directory

Change-Id: I49702b02ba98a177027b126268c2c2846f968195
2011-01-18 17:39:24 -08:00
Ken Sumrall
4e84d3bcf9 Set a read-only property to indicate if the device is running encrypted.
The UI needs to know if the device is running with an encrypted
filesystem or now.  So set a read-only property at boot to let it know.

Change-Id: I753de2d606c975bcbe9946d10fd47558cf357dac
2011-01-14 12:44:09 -08:00
Ken Sumrall
752923c168 Changes to init to support encrypted filesystems.
These are the changes to init and init.rc necessary to
support booting with and encrypted /data filesystem.
A corresponding change to init.<device>.rc goes along
with this change.

Change-Id: I0c7e2cc39568358014a82e317735c0eae14dd683
2010-12-18 19:03:54 -08:00
Colin Cross
f83d0b9af5 init: Move uevent handling to an external ueventd process
Change-Id: Iea6c56013062ade633a1754f7bcf8cf09b3dedc1
2010-04-21 20:59:38 -07:00
Colin Cross
6310a8261c init: Split parser into generic parser and init parser
Change-Id: I451ebc4ff12f2ac660eb533fa10ad561fa25c9dd
2010-04-21 19:43:40 -07:00
Colin Cross
cd0f173e27 init: Add wait command and mount wait flag
Change-Id: I6b4c10f8f246095a7fb7342388ec4f6ff97d5733
2010-04-21 19:43:35 -07:00
Colin Cross
ed8a7d8442 init: Move list and log handling to list.h and log.h
Change-Id: I298f575c590d0f28b7ad78747f3ebdbba56b7a27
2010-04-21 19:43:35 -07:00
Colin Cross
ebc6ff105a init: Handle commands in event queue loop
Change-Id: I679059dae43143f3c8f16b68de5694539b699e50
2010-04-16 19:02:32 -07:00
Colin Cross
3899e9fc01 init: Move prototypes for util.c into util.h
Change-Id: I46a91849ce5297eb2597dd6134412f817564ec24
2010-04-13 22:52:10 -07:00
Colin Cross
ca7648ddfb init: Move parser prototypes to parser.h
Change-Id: I31db51eb8e8a33a0bd06b41206bc9f9147d16d41
2010-04-13 22:51:12 -07:00
Tom Zhu
4d0b21f4ac am 4833d9f4: init: builtins: trancate target file in do_copy
Merge commit '4833d9f4986d6dafacff841beb3bf93172c84bdc' into eclair-plus-aosp

* commit '4833d9f4986d6dafacff841beb3bf93172c84bdc':
  init: builtins: trancate target file in do_copy
2009-09-30 14:25:47 -07:00
Tom Zhu
4833d9f498 init: builtins: trancate target file in do_copy
add O_TRUNC flag in open(), which will truncate the target file,
otherwise, copy will keep the old content of the target file.

Signed-off-by: Tom Zhu <ling.zhu@motorola.com>
Signed-off-by: San Mehat <san@google.com>
2009-09-30 14:15:49 -07:00
Jean-Baptiste Queru
8c92ba1921 merge from open-source master 2009-09-01 08:28:21 -07:00
Jay Freeman (saurik)
e7cb137f32 added chdir/chroot commands to init for mount switching/pivoting 2009-08-27 07:43:28 -07:00
Jay Freeman (saurik)
9f28bde9eb Trivial implementation of init's import command. 2009-08-27 07:40:19 -07:00
San Mehat
7c44fe5925 init: builtins: Add 'copy' command to init.rc parser
Signed-off-by: San Mehat <san@google.com>
2009-08-26 16:39:59 -07:00
Jay Freeman (saurik)
11e1c42df6 completed implementation of "trigger" for init 2009-08-25 13:00:11 -07:00
Jean-Baptiste Queru
96d58f4f52 Merge korg/donut into korg/master 2009-07-25 18:07:41 -07:00
Mike Chan
008abac082 init now returns proper error codes in dmesg for write command (init.rc)
Signed-off-by: Mike Chan <mike@android.com>
2009-06-29 20:30:55 -07:00
San Mehat
8ad15685e6 resolved conflicts w/ f24e252903 merge... 2009-05-20 08:50:40 -07:00
San Mehat
f24e252903 init: Add the ability to start services with dynamic arguments.
To add arguments dynamically to a service, start the service like so:

    setprop ctl.start service_to_run:arg1 arg2 arg3...

    To start a service with *no* dynamic arguments, start the service normally:

    setprop ctl.start service_to_run

    Dynamic arguments are only supported on 'oneshot' services

Signed-off-by: San Mehat <san@google.com>
2009-05-19 13:33:07 -07:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00