Commit Graph

10 Commits

Author SHA1 Message Date
Oliver Smith 4715c0f1bf
pmbootstrap: Disallow running as root (#1120) 2018-01-14 08:13:35 +00:00
Oliver Smith 7750c1dd40
Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
Oliver Smith c403edefe4
pmbootstrap init: ask for work folder before asking for device (#1068)
This fixes #1066, where pmbootstrap crashes with a permission error
when you run it for the first time (no work folder exists) and you
run the boot.img analyzer because you want to start a new device
port.

It also prints a more helpful message if pmbootstrap crashes before
the log file was generated (suggests to use --details-to-stdout).
2018-01-02 04:38:28 +00:00
Oliver Smith 77a90b9e01
pmbootstrap: Check if work folder exists before doing anything (#966)
Fixes #949.
2017-12-02 16:40:55 +00:00
Oliver Smith d3c77c39ac
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
  access the functions it contains in testcases, and still use
  pmb.build.package()
* Refactor the entire file. Instead of one big function that does
  too many things, we have many small ones now, that are tested
  in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
  install the "makedepends" (like we did before), now it does the
  same for the "depends". That's required to be compatible with
  abuild. The old behavior can still be used with 'pmbootstrap
  build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
  the native chroot if we need them for a foreign chroot. A device-
  package depending on a kernel would pull in the same kernel for
  the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
  and without a matching '--arch' displays a note that explains
  this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
  implemented for packages built in the native chroot, and now that
  is not always the case anymore. Symlinking these packages creates
  packages with broken dependencies anyway (e.g.
  device-samsung-i9100 can't be installed in x86_64, because
  linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
  sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
  first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
  this feature.
* Removed the old "build" test case (which was disabled in
  testcases_fast.sh) as the new "build_package" test case covers its
  functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
  couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
Jochen Sprickerhof c50ecd7c5a Unset restrictive umask before creating files (#908)
If a user has a restrictive umask (for example 0077) set, it will be
inherited to sudo and thus files created with sudo where not readable by
the normal user. In that case, when setting up a new chroot, the
etc/apk/repositories file would have umask 600 and a os.path.exists()
(in update_repository_list) would return false. Setting the umask to 022
(octal) first, results in world readable files and directories, so the
user running `./pmbootstrap.py install` can read them.
2017-11-14 21:02:56 +00:00
Oliver Smith 6627599cf0
pmbootstrap init: Wizard for new port device- and linux-packages (#821)
* pmbootstrap init: Generate new port device- and linux-package
* adds `pmbootstrap aportgen device-*` and
  `pmbootstrap aportgen linux-*`
* ask for confirmation when selecting a non-existing device
* generate the packages directly from init
* refactor aportgen code
* fixed some easy things in the linux- APKBUILD (more to come in
  follow-up PRs!)

Testing:
* Test all questions to the user from pmb.config.init and pmb.aportgen.device
  (except for the timezone question, because we would need to monkeypatch the
  os.path.exists() function, which messes up pytest, so we'd need to refactor
  the timezone function to be more testsuite friendly first)
* Run the device wizard in a testcase a few times and check the output, that
  pmbootstrap.aportgen.device and pmbootstrap.aportgen.linux create by parsing
  the resulting APKBUILDs and deviceinfo and checking its contents.
* Build the generated device package once in the same testcase

Thanks a lot to @drebrez for all the help with this one:
<https://github.com/postmarketOS/pmbootstrap/pull/821>

See also the updated porting guide:
<https://wiki.postmarketos.org/wiki/Porting_to_a_new_device>
2017-10-30 19:56:38 +00:00
Pablo Castellano b4dd7a89d2 Close #709: Improve user creation (#725)
* Allow to specify a custom username in "pmbootstrap init"
* Build chroots have "pmos" instead of "user" as username now
* Installation user UID is 1000 now (as in all other Linux distributions)
* Adjust autologins
* postmarketos-base: enable wheel group for sudo, removed previous sudoers file
* Implement safe upgrade path:
We save the version of the work folder format now, in $WORK/version.
When this file does not exist, it defaults to 0.
In case it does not match the currently required version
(pmb.config.work_version), then ask the user if it should
automatically be upgraded.
2017-10-12 20:08:10 +00:00
Yuval Adam b6003a2815 Close #327: Add initial setup.py (#443) 2017-09-02 19:30:40 +00:00
Oliver Smith ae950fb9f7
Hello, there! 2017-05-26 22:08:45 +02:00