forked from Mirror/pmbootstrap
Remove a legacy code path from back in the day, where pmaports were in
the same repository as pmbootstrap ([1]). Nowadays, pmaports are always in a
git repository, so this is not necessary anymore. If git fails at this
point, crash hard and don't carry on with an empty string.
This is in preparation for using rev_parse in new code paths, so we
don't need to check the return value of rev_parse.
[1] 39548835
"Write custom os-release (closes #324) (#439)"
https://github.com/postmarketOS/pmbootstrap/pull/439
42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
"""
|
|
Copyright 2020 Pablo Castellano
|
|
|
|
This file is part of pmbootstrap.
|
|
|
|
pmbootstrap is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
pmbootstrap is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
import logging
|
|
|
|
import pmb.config
|
|
import pmb.helpers.git
|
|
|
|
|
|
def write_os_release(args, suffix):
|
|
logging.info("(" + suffix + ") write /etc/os-release")
|
|
revision = pmb.helpers.git.rev_parse(args)
|
|
filepath = args.work + "/chroot_" + suffix + "/tmp/os-release"
|
|
os_release = ('PRETTY_NAME="postmarketOS {version}"\n'
|
|
'NAME="postmarketOS"\n'
|
|
'VERSION_ID="{version}"\n'
|
|
'VERSION="{version}-{hash:.8}"\n'
|
|
'ID="postmarketos"\n'
|
|
'ID_LIKE="alpine"\n'
|
|
'HOME_URL="https://www.postmarketos.org/"\n'
|
|
'SUPPORT_URL="https://gitlab.com/postmarketOS"\n'
|
|
'BUG_REPORT_URL="https://gitlab.com/postmarketOS/pmbootstrap/issues"\n'
|
|
'PMOS_HASH="{hash}"\n'
|
|
).format(version=pmb.config.version, hash=revision)
|
|
with open(filepath, "w") as handle:
|
|
handle.write(os_release)
|
|
pmb.chroot.root(args, ["mv", "/tmp/os-release", "/etc/os-release"], suffix)
|