Commit Graph

179 Commits

Author SHA1 Message Date
David Michael
45ef8cea91 enter_chroot: Drop special locale-gen handling
The glibc ebuild runs locale-gen itself while installing.
2018-04-04 12:53:20 -04:00
David Michael
7f99054c9d Merge pull request #687 from dm0-/workon-mantle
enter_chroot: initialize with mantle in cros_workon
2017-08-10 17:39:45 -07:00
Benjamin Gilbert
b5f19e5d75 enter_chroot: Fix ownership of /run/user/UID
We were chowning the host directory, not the one in the chroot.

Host gpg >= 2.1.13 puts the gpg-agent socket in /run/user/UID/gnupg,
which is bind-mounted into the chroot, but the SDK gpg was ignoring it
because /run/user/UID was not owned by UID. This broke tag signing with
YubiKeys.
2017-05-31 13:52:16 -07:00
David Michael
cbe102142b enter_chroot: initialize with mantle in cros_workon 2017-05-26 14:43:42 -07:00
Michael Marineau
8e754f9c2b enter_chroot: do not export variables that weren't previously exported
COREOS_BUILD_ID is set to a default value in common.sh if unset in the
environment. When entering the chroot this default value should not then
get promoted into the environment. Doing so causes catalyst to re-use
stale builds and multiple build_image runs to conflict with each other.
2016-05-25 17:04:38 -07:00
Michael Marineau
db5d937aab Merge pull request #491 from marineam/bind-root
enter_chroot: fix chroot root bind command
2015-12-15 16:44:28 -08:00
Michael Marineau
3fdd2033dc enter_chroot: fix chroot root bind command
Commit 09851b84 didn't do a recursive bind by mistake, so if the host
system has anything mounted under the chroot directory for some reason
the bind would hide those mounts. Recursive ensures existing mounts
remain exposed as they did before.
2015-12-15 16:40:00 -08:00
Michael Marineau
2b43e553e3 Merge pull request #490 from marineam/bind-root
enter_chroot: ensure the chroot's root directory is a mount point
2015-12-15 16:34:01 -08:00
Michael Marineau
09851b8460 enter_chroot: ensure the chroot's root directory is a mount point 2015-12-15 16:30:27 -08:00
Michael Marineau
863dda280f enter_chroot: skip calling locale-gen if it isn't installed 2015-12-10 11:33:57 -08:00
Michael Marineau
ec58813496 enter_chroot: always bind $GNUPGHOME to the default path
The path of $GNUPGHOME outside the chroot may not really make sense
inside the chroot. Although that's probably not a big deal there's no
need to keep the outside value. Instead just bind it to the usual spot.
2015-12-01 14:34:43 -08:00
Michael Marineau
14ada5cfe7 Merge pull request #483 from marineam/jenkins
Updates for jenkins builds
2015-12-01 12:03:13 -08:00
Alex Crawford
47d237ecab sdk_lib: cleanup to support non-standard environs 2015-11-30 18:15:42 -08:00
Michael Marineau
39a3a48a18 enter_chroot: add support for passing through GNUPGHOME
When running under jenkins the $GNUPGHOME may be located under the
current build directory instead of $HOME to avoid conflicting with other
jobs on the same build host.
2015-11-29 14:05:08 -08:00
Michael Marineau
aa4ba8b2bb bootstrap_sdk: do not remove make.conf, turns out catalyst runs sed over it 2015-07-06 13:14:51 -07:00
Michael Marineau
1fa7ef236b update_chroot: remove dependency on complex 'chromeos-cache' links
The distfiles cache is always under .cache in the repo tree but there is
a lot of extra logic to make that configurable along with compatibility
symlinks for previous locations. Just yank it all out.
2015-07-05 17:54:00 -07:00
Michael Marineau
611ed7698e enter_chroot: remove subversion config goo
We do not have any svn based live ebuilds that require credentials which
I presume is the only reason for shuffling svn configs like this.
2015-07-05 17:20:43 -07:00
Michael Marineau
db734ea417 bootstrap_sdk: do not leak catalyst config into sdk tarballs
The version of repos.conf/coreos.conf that catalyst needs isn't valid
for normal SDK chroots and causes env-update to spew errors when it is
run prior to update_chroot which configures portage properly.
2015-07-05 16:57:05 -07:00
Michael Marineau
174a847e36 update_chroot: remove dependence on /usr/local/portage/* symlinks
A step in reducing the amount of initialization code required: drop
needless symlinks under /usr/local/portage to the portage trees. Just
configure portage to point directly at the source instead. Only crossdev
remains in that location because it is a locally managed overlay.
2015-07-05 16:57:05 -07:00
Michael Marineau
729f9da872 common: make sure /etc/mtab is correct before mounting anything
If mtab ever gets replaced by a regular file all sorts of things break.
2014-12-03 16:30:19 -08:00
Michael Marineau
ae9d6252bc make_chroot: remove unneeded modifications
These are assorted tweaks that are already setup in the tarball.
2014-09-15 16:19:25 -07:00
Michael Marineau
81ce75300f cleanup: remove source location migration code
This code is not applicable to us, it predates CoreOS and is a weird
thing for common.sh to be doing as well. Instead always define
CHROOT_TRUNK_DIR to /mnt/host/source, create ~/trunk in make_chroot.
2014-09-14 15:32:10 -07:00
Michael Marineau
09e720e821 cleanup: remove a couple references to chrome-bot 2014-09-14 14:54:35 -07:00
Michael Marineau
6df3bbbe2e sdk: assert host system is running Linux 3.7 or later
Currently building images on older kernels will fail because mkfs.btrfs
enables an incompatible feature 'extref' by default. We never really
made this requirement explicit and the SDK in general has continued to
maintain compatibility with older kernels. Make the requirement explicit
so users will get errors quicker and there is a clear line for what
kernel features can be used in the SDK.
2014-09-02 15:55:52 -07:00
Michael Marineau
2991ad8cd8 chroot: remove git from $PS1
This feature is disabled for now. See c8a62a12 for details.
2014-08-18 16:40:34 -07:00
Michael Marineau
c8a62a12ee make_chroot: don't enable git-prompt via bashcomp
Newer git ebuilds have decided that the "git-prompt" script isn't really
bash completion so stopped installing it via that mechanism. Instead it
installed it started installing it in /usr/share/docs which gets
compressed by default and the path is based on ebuild version. The path
changed again in 1.9.3 to /usr/share/git and didn't compress it so that
makes it actually possibly usable but 1.9.3 or later isn't stable yet.

We can re-enable it the next time git gets updated but not worth fussing
over the current brokenness right now.
2014-08-16 13:36:57 -07:00
Michael Marineau
4d3c198161 tools: remove support for parallel_emerge
Using parallel_emerge has been disabled by default for all commands
except build_image for quite a while now, build_image kept it just
because it was still a bit faster than normal emerge. Keeping
parallel_emerge complicates future changes to build_image so it needs to
drop it entirely. Since that means nothing uses it by default we might
as well just rip out support for it entirely.
2014-07-19 16:38:17 -07:00
Michael Marineau
4b23a26667 update_chroot: fix transition to new os-release location
Previously /etc/os-release was installed both by set_lsb_release and
the baselayout package. Now it is only installed by set_lsb_release but
when baselayout is upgraded it removes /etc/os-release. So the first
update_chroot works but the second detects the chroot's version
incorrectly and tries to apply the one time updates in this directory.
Both of them are very old so we can just delete them. The second run
will now fix up /etc/os-release and we can all move on and be happy.
2014-07-14 17:59:15 -07:00
Michael Marineau
946f730d7f enter_chroot: set reasonable PATH when calling locale-gen 2014-07-03 15:23:18 -07:00
Michael Marineau
a075b1085a make_chroot: explicitly set path when entering the chroot.
The host system's PATH may not be match the one required by the SDK.
When going through the enter_chroot script it gets reset because bash is
invoked as a login shell but this doesn't happen when using the plain
old chroot command.

Fixes https://github.com/coreos/scripts/pull/290
2014-07-03 14:51:32 -07:00
Michael Marineau
18d796ff3e fix(sdk-lib): Mount a fresh /run directory.
There is no need to arbitrarily bind mount all of the host system's /run
into the chroot. In fact this causes issues when the host system's /run
isn't set up in a way this script anticipates. Namely the user runtime
directory in /run/usr/$UID is another tmpfs mount on my system, leaving
the underlying directory node that is bind-mounted in with the wrong
ownership. Behave a little more like a responsible container and use a
fresh /run but continue binding /run/shm for whatever versions of Ubuntu
that depended on that behavior. Not strictly needed but go ahead and
create the user runtime directory with the correct permissions.
2014-05-27 19:26:34 -07:00
Michael Marineau
f2f74b3423 fix(sdk_lib): Clean up ssh file copying
- Don't copy known_hosts if it doesn't exist.
- Don't bother with copying *.pub, not sure what that was for.
- Don't rewrite .ssh/config to remove internal Google ssh options.
2014-05-27 17:32:58 -07:00
Michael Marineau
796be0a520 fix(sdk_lib): Test for host file existence before copying.
The main case here is /etc/hosts does not exist on CoreOS. In the
process combine related and duplicate code. Setting the timezone now
happens in entire_chroot like hosts and resolv.conf. Don't bother with
setting a default UTC time zone, that is already the default.
2014-05-27 17:32:54 -07:00
Michael Marineau
47daca491c fix(sdk_lib): Remove depot_tools mount
We now include repo in the SDK which was the only thing from depot_tools
that we depended on.
2014-05-27 16:39:49 -07:00
Michael Marineau
2e9911b978 fix(*): Migrate image storage to new buckets
- Automated builds drop SDK and binary packages into
  gs://builds.developer.core-os.net/ and the new download URL is
  http://builds.developer.core-os.net/ (COREOS_DEV_BUILDS)
- Change default upload path to gs://users.developer.core-os.net/ for
  misc developer builds. Official builds go elsewhere and will just be
  configured in buildbot/jenkins so some COREOS_OFFICIAL stuff is gone.
- Automated builds of images go to a private bucket,
  gs://builds.release.core-os.net which later gets copied to
  gs://alpha.release.core-os.net and friends by core_promote.
2014-05-21 13:21:07 -07:00
Michael Marineau
68a8a67081 fix(update_chroot): Consolidate more portage configuration
To behave more like setup_board/build_packages update_chroot should
fully configure portage to make sure everything is accurate.

Now binhosts are defined in make.conf.host_setup so the static config in
coreos-overlays doesn't need to refer to version.txt. setup_board
already made this change in 7a43a07f.

Define path locations to reduce dependency between static configs in
coreos-overlays and the behavior of the scripts repo. Spreading
configuration across two repos makes everything harder to understand.
Eventually everything should either be defined in profiles in
coreos-overlays or minimal auto-generated config files here in scripts.
2014-05-14 19:15:30 -07:00
Michael Marineau
57d19d0f06 refactor(update_chroot): Write make.conf.host_setup
There is no need for this to be in sdk_lib any more, remove what little
remains of make_conf_util.sh.
2014-05-14 18:51:58 -07:00
Michael Marineau
a3d3d30b24 fix(sdk_lib): Delete a pile of dead/pointless code.
For the most part this doesn't influence anything. The one exception is
the custom configuration for using curl is dropped, just rely on the
portage defaults. It appears curl was only used to work around a wget
issue with Google's internal SSL certificates. We care not. :)
2014-05-14 18:51:58 -07:00
Michael Marineau
3e39c612eb fix(make_chroot): Simplify chroot user creation.
The commands useradd/usermod will silently skip adding users to
secondary groups that are not in /etc/group. The idea being that the
tools should not create groups that conflict with existing LDAP/NIS
groups but why trying to do so isn't a fatal error I don't know.

Overall the code is rather complicated and tries to modify instead of
add when possible to allow running the SDK as the 'core' user. To keep
things simple gut this code, make the 'core' user special, and add
secondary groups via the 'gpasswd' command so that errors are reported
instead of silently ignored.

One functional change: the default groups have changed to kvm and
portage. The old list excluded kvm and included lots of extra cruft.
2014-03-21 19:46:32 -07:00
Michael Marineau
16bc3521e5 fix(make_chroot): Fix SDK setup w/ empty passwd and group files
New baselayout 3 based SDKs define system files in separate read-only
files so the normal group and passwd files don't exist yet.
2014-02-17 22:48:52 -08:00
Michael Marineau
50e54cea85 fix(release_util): Move default upload root to common, add --upload_root
Make it possible for other scripts to share the same value for our
release repository and equally easy to override with a custom value.
Also allow setting the root from the command line in addition to the
environment. Usually --upload_root is better to use than --upload_path.
2014-02-07 10:37:45 -08:00
Michael Marineau
6452857e82 fix(*): Change default for --jobs to $NUM_JOBS
This makes parallelism behavior between parallel_emerge and emerge
consistent. NUM_JOBS is defined as the number of CPUs by common.sh
2013-12-01 16:04:10 -08:00
Michael Marineau
c9c1efd276 fix(build_image): Add --fast to control use of parallel_emerge
This makes it possible to toggle parallel_emerge just as other scripts
do. In other scripts update the help string to be more specific, the
--jobs option can be used to control parallelism.
2013-12-01 16:04:10 -08:00
Michael Marineau
c5c5696c8b fix(make_chroot.sh): Remove duplicate chroot toolchain setup code.
Instead of handling toolchain packages in make_chroot and telling
update_chroot to skip the toolchains just depend on update_chroot to do
it properly. Reduces our code duplication by a tiny but worthwhile bit.
2013-11-25 16:38:32 -08:00
Michael Marineau
59ef0901d3 add(sdk_util.sh): Port basic SDK download logic to a shell library.
The current logic for downloading SDK tarballs is in cros_sdk and
written in python which isn't super convenient for re-using in the rest
of our shell scripts. This is a start of rewriting that logic into a
re-usable library but does not yet replace the functionality in cros_sdk.
2013-11-23 20:31:46 -08:00
Michael Marineau
65b9977b80 add(129.0.0_python_exec_transition.sh): gracefully upgrade python-exec
We've had trouble with eclean and equery vanishing in our SDKs from time
to time. Although I don't know the root cause it seemed to be some
confusion in the ebuild environment, perhaps a mis-match between the
eclasses, profiles, and ebuilds. Updating all of those seemed to resolve
the issue and to make sure other environments are ok force a re-install
of portage and gentoolkit to clean things up.
2013-11-06 20:14:20 -08:00
Michael Marineau
d250db92cb feat(sdk_lib): Bind mount GnuPG directories into the chroot. 2013-09-06 16:16:28 -07:00
Michael Marineau
e111aec543 fix(make_chroot): Fix support for new users with existing groups.
When a user creates a chroot and as a common primary group such as
'users' the groupadd command fails. Instead treat this the same as users
and only fail if the group exists but has a different (such as the
'users' group not using GID 100). Hopefully this works better.
2013-09-06 12:06:53 -07:00
Michael Marineau
607c4b1cd5 fix(make_chroot): Don't fail if user's full name is blank.
It is perfectly valid for the comment field in a passwd file to be
blank so don't treat that as an error. Sorry backjlack :-/
2013-08-26 12:06:47 -04:00
Michael Marineau
6c2f9a9ffb fix(make_chroot): Improve chroot user creation.
If the user already exists check that the UID and GID are correct and
modify it (setting shell and home directory) to match what the SDK
expects. This avoids needlessly failing if the user calling cros_sdk is
the 'core' user on a CoreOS machine.

Change new-user creation to copy the user's full name and group instead
of using a generic name and Google's 'eng' group. Also remove the
default password for the account, it isn't needed and uses perl.
2013-08-26 00:53:13 +00:00