Change default user uid to 10000

This commit is contained in:
NotKit 2018-08-02 20:10:56 +00:00 committed by Oliver Smith
parent e82b7e427d
commit e22ba8caea
22 changed files with 53 additions and 34 deletions

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-android-recovery-installer
pkgver=0.1.7
pkgrel=0
pkgrel=1
pkgdesc="TWRP compatible postmarketOS installer script"
url="https://postmarketos.org"
# multipath-tools: kpartx
@ -29,6 +29,6 @@ package() {
sha512sums="924f961e1a488134d265f43724d2b06a908ac1522706dc3f7118f0dec16453aa0a928fef6d9a31a6a747910df665e64f25c94c47a9e3f1d57db19abb0fd8210d build_zip.sh
6390fc1b1c7dc8e917bb675d2e59e479782ac7754e97c4781866360ff704afe2d04f173a0ac74e3129db45328fab4b6b77a8717ee2e17c6ff79febadaa8ea034 update-binary
f19c15fd99cc806d088ddf9c954111e48635f971ca500beeaa4893eb25d19fe0601210a57e9ab1a1dc7a6d79a3154765e696ee3329bbb1875b6d6df36a7b3fb3 pmos_chroot
d65b72ffb1140425bf96b1e3ef75a517bebbfa70e6bdc584dbd91c2cbefce63377c744b3b33f1967bad37cb368aa746e25d25b10eebf464399b262f62378b0f4 pmos_install
94d06a7a73f76eb737e65ca2828f3c59d9cc532f2d2ec200e1407cd8fc266be192e33a8baa923e460a4335c7f5fb5232675d2e2e98a7e1ed07a257c67a0a5c5d pmos_install
514881d7812197830869c73428acc88f8a94dd02184634406ffe47884cd21d7b02ecc7806dae39308f026b1dbfca9ceee714fdfdc2bebc3ebcdeed71865de2b2 pmos_install_functions
c6355b6d823dac883e1a352f59a9a2199e2934d78a73df72dc3c4fc14ef93765a15179203d4a8a2ca0d841b63cd4c25c4689b63c8cf4d4da2bcec1f8ff76bff5 pmos_setpw"

View File

@ -113,9 +113,9 @@ unzip -p pmos.zip rootfs.tar.gz | tar -xz -C /mnt/pmOS
ui_print "Creating home folder..."
mkdir /mnt/pmOS/home
user="$(awk -F ':' '$3 == "1000" {print $1}' /mnt/pmOS/etc/passwd)"
user="$(awk -F ':' '$3 == "10000" {print $1}' /mnt/pmOS/etc/passwd)"
cp -a /mnt/pmOS/etc/skel /mnt/pmOS/home/"$user"
chown -R 1000 /mnt/pmOS/home/"$user"
chown -R 10000 /mnt/pmOS/home/"$user"
ui_print "Configuring apk..."
sed -i '/\/mnt\/pmbootstrap-packages/d' /mnt/pmOS/etc/apk/repositories

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-hildon
pkgver=1
pkgrel=4
pkgrel=5
pkgdesc="(X11) Lightweight GTK+2 UI (optimized for single-touch touchscreens)"
url="https://postmarketos.org"
arch="noarch"
@ -30,6 +30,6 @@ package() {
install -D -m644 "$srcdir"/xinitrc_hildon.sh \
"$pkgdir"/etc/postmarketos-ui/xinitrc_hildon.sh
}
sha512sums="6c446fd2c0c50b10bf3bd4da93520b975f3632dab24c34eb33f22af7fdd2d96b8d7b605a4aee0c8e2544f56b7fd2dfc0ad39dc57b11cb2eb8c952f823d1b2987 start_hildon.sh
sha512sums="614c36acb7932f86db4e189411404fac2d56bec7c4ebc0f4de336e7d46e1bde786a0f1b42be916ac43b47d3e7e7b32f4b5991212b0d452195e61ceba55d358f8 start_hildon.sh
5ef5710bee7bde99e1f240eb8873239c452b55c6dc943930e181d091835824094cf56bf29ae1b34d792ba0ce27f76e30ea69f3c125dda3bf286eaaaba8c8e6ae xinitrc_hildon.sh
64007cebcfbb9d8cdc4db7f889722509e1090af0712802300611fb805e00e1de474e4e6b538d0d99be05ca25f983e94aab57e04b4cc8282ba0ae44609d1a7366 postmarketos-ui-hildon.post-install"
733b9374e60bf6972d26da717dda039ab21b4052fe1a80881941971b9e1e99e315d184b48e9a064c36b1de5cbe3cfcf7b4819925b0a8948d447951ae8e580078 postmarketos-ui-hildon.post-install"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"

View File

@ -4,7 +4,7 @@
# /etc/inittab by postmarketos-base post-install.hook).
# This is a temporary solution, we'll need something like a
# display manager in the long run (#656).
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "10000" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start X11 with Hildon
startx /etc/postmarketos-ui/xinitrc_hildon.sh 2>&1 | logger -t "$(whoami):x11"

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-matchbox
pkgver=1
pkgrel=2
pkgrel=3
pkgdesc="(X11) Very basic user interface for handhelds"
url="https://matchbox-project.org"
arch="noarch"
@ -16,4 +16,4 @@ package() {
"$pkgdir"/etc/profile.d/start_matchbox.sh
}
sha512sums="9286e12744fc313fd3ed842dbc524226c2714cffb6fdd1327ff079527546a5c0b0738ce5a444fd534fb267fbde2759b552784cbed09ec988cd4abfa2d0001319 start_matchbox.sh"
sha512sums="c974333da4a4a829969df87edd737e8e1fca78ad9f9b38df10c9031317c4b06dcdf7666b31d39ca2e3ef1a8ac7b4bacdfda2d3e0fed57523489065cd7e5c9bb9 start_matchbox.sh"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"

View File

@ -4,7 +4,7 @@
# /etc/inittab by postmarketos-base post-install.hook).
# This is a temporary solution, we'll need something like a
# display manager in the long run (#656).
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "10000" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start X11 with Mate
startx /usr/bin/matchbox-session 2>&1 | logger -t "$(whoami):x11"

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-mate
pkgver=1
pkgrel=3
pkgrel=4
pkgdesc="(X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)"
url="http://mate-desktop.org/"
arch="noarch"
@ -20,5 +20,5 @@ package() {
"$pkgdir"/usr/share/glib-2.0/schemas/000-system-background.gschema.override
}
sha512sums="a5a48821538b18069bad6528d488ed2dd5ae7d4f4fa095215c30d5399a41e645300f0c70bef1178be085e5fe8510fb4dda5446585663fd57193e938558b803de start_mate.sh
sha512sums="bc4d0fda2c95d375433b7a6ba327e747e0b58fb69dda12dbdd44fe99ebd961a78793e4fa17bc719d681aa2afdd7ab0c823ae874c3b7c5a6a254301cb9e6cb289 start_mate.sh
b4eded3d1aba2086d53507d434da6f2d5aae24fa49c7a8619abb1d81f87898d7a6d813be777a285ce988d78db236bea7507e7868c39fe020e5d23c230dd36242 000-system-background.gschema.override"

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"

View File

@ -4,7 +4,7 @@
# /etc/inittab by postmarketos-base post-install.hook).
# This is a temporary solution, we'll need something like a
# display manager in the long run (#656).
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "10000" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start X11 with Mate
startx /usr/bin/mate-session 2>&1 | logger -t "$(whoami):x11"

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-plasma-mobile
pkgver=1
pkgrel=14
pkgrel=15
pkgdesc="(Wayland) Mobile variant of KDE Plasma, optimized for touchscreen (aarch64, x86_64 or hardware acceleration required!)"
url="https://wiki.postmarketos.org/wiki/Plasma_Mobile"
arch="noarch"

View File

@ -3,7 +3,7 @@
. /etc/deviceinfo
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-weston
pkgver=4
pkgrel=4
pkgrel=5
pkgdesc="(Wayland) Reference compositor (demo, not a phone interface)"
url="https://postmarketos.org"
arch="noarch"
@ -21,6 +21,6 @@ package() {
install -Dm644 "$srcdir"/weston.ini.default \
"$pkgdir"/etc/xdg/weston/weston.ini.default
}
sha512sums="4de1a34464db86dd25b306efb676c292152df093daa7850af3cb1b9fe198c01f9ab6a02d171b61b43af4d60009991182f18b9727bad3fd3d763df3797cbdb716 start_weston.sh
sha512sums="6c278d6018e7a1eea1e7285a93dc2fc6c0598c96e8cc5dc094e98be4d07edc6a5a10332d6f12f64ae7a9489b375a67b24e553569e71b274d1b681a0c4658450d start_weston.sh
b712c9d4c846437656781656ec15e9b7e238a9244e0b77bf84b67f6661d44f68718330706f69ccb8b4d7f6182b8f17f273018ca461c0c40e49b9185f6eec168d weston.ini.default
794827b6878cdca8231fc106ba649a3e9aa9f74df0ef7e5e3598462b3c93c67cb3b0af95cadb92a62471730a518024ae6be95c0fc59af6b929482148f16c2184 postmarketos-ui-weston.post-install"
d8f748b896c5cc474b76cc9d87a0becb4e44ae7220f5cb9468f2e0ecabdc2207739754064489b8e21cd87214058f2a5c6c24cff1688e2eb50999b2feea3f9217 postmarketos-ui-weston.post-install"

View File

@ -3,7 +3,7 @@
. /etc/deviceinfo
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"
@ -13,5 +13,5 @@ done
# Create weston-launch group and add user to it
[ $(getent group weston-launch) ] || groupadd weston-launch
username="$(getent passwd 1000 | cut -d ":" -f 1)"
username="$(getent passwd 10000 | cut -d ":" -f 1)"
usermod -a -G weston-launch "$username"

View File

@ -12,7 +12,7 @@ if test -z "${XDG_RUNTIME_DIR}"; then
# Weston autostart on tty1 (Autologin on tty1 is enabled in
# /etc/inittab by postmarketos-base post-install.hook)
if [ "$(id -u)" = "1000" ] && [ $(tty) = "/dev/tty1" ]; then
if [ "$(id -u)" = "10000" ] && [ $(tty) = "/dev/tty1" ]; then
# Find right weston.ini
cfg="/etc/xdg/weston/weston.ini"

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-xfce4
pkgver=0.2
pkgrel=2
pkgrel=3
pkgdesc="(X11) Lightweight GTK+2 desktop (stylus recommended)"
url="https://gitlab.com/postmarketOS/xfce4-phone"
arch="noarch"
@ -22,5 +22,5 @@ package() {
cp -a "$builddir"/config "$pkgdir"/etc/skel/.config
}
sha512sums="6cf45653ca0c96eb7fe0a7b78db1565e24e7893a2113b9eabf22285cb58b90a41b94c69de2b3a316ab759719f715555751cc51a30e00f358b940d694e7850625 start_xfce4.sh
sha512sums="14bc00ba8b4970f044753d648c3f4ac0a289c98c8586ab9eb79236eef93e771a3306694daa6e957d9c9e396e52bccfdfa3e88ea9e53e3c78b32470bc3b1ea5ff start_xfce4.sh
4321a2a24b45f0d33b586ef098cfb236d87f557e7e2fecb180774d1cb1bc9fa1edfe6ce8a1faa646adcb026b4ef1b03b477eae0c46f4c46c8488baabb9c382e3 postmarketos-ui-xfce4-0.2.tar.gz"

View File

@ -3,7 +3,7 @@
. /etc/deviceinfo
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="$(getent passwd 1000 | cut -d ":" -f 1)"
autologin="$(getent passwd 10000 | cut -d ":" -f 1)"
for i in 1 2 3 4 5 6; do
old="^tty$i::respawn:/sbin/getty 38400 tty$i"
new="# tty$i::respawn:/sbin/getty 38400 tty$i"

View File

@ -4,7 +4,7 @@
# /etc/inittab by postmarketos-base post-install.hook).
# This is a temporary solution, we'll need something like a
# display manager in the long run (#656).
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "10000" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start X11 with XFCE4
ck-launch-session dbus-launch --exit-with-session startxfce4 2>&1 | logger -t "$(whoami):x11"

View File

@ -42,7 +42,7 @@ apk_tools_static_min_version = "2.9.0-r0"
# Version of the work folder (as asked during 'pmbootstrap init'). Increase
# this number, whenever migration is required and provide the migration code,
# see migrate_work_folder()).
work_version = 2
work_version = 3
# Only save keys to the config file, which we ask for in 'pmbootstrap init'.
config_keys = ["ccache_size", "device", "extra_packages", "hostname", "jobs",

View File

@ -134,6 +134,22 @@ def migrate_work_folder(args):
migrate_success(args, 2)
current = 2
if current == 2:
# Ask for confirmation
logging.info("Changelog:")
logging.info("* Device chroots have a different user UID (#1576)")
logging.info("Migration will do the following:")
logging.info("* Zap your chroots")
if not pmb.helpers.cli.confirm(args):
raise RuntimeError("Aborted.")
# Zap chroots
pmb.chroot.zap(args, False)
# Update version file
migrate_success(args, 3)
current = 3
# Can't migrate, user must delete it
if current != required:
raise RuntimeError("Sorry, we can't migrate that automatically. Please"

View File

@ -156,7 +156,7 @@ def create_home_from_skel(args):
homedir = rootfs + "/home/" + args.user
pmb.helpers.run.root(args, ["mkdir", rootfs + "/home"])
pmb.helpers.run.root(args, ["cp", "-a", rootfs + "/etc/skel", homedir])
pmb.helpers.run.root(args, ["chown", "-R", "1000", homedir])
pmb.helpers.run.root(args, ["chown", "-R", "10000", homedir])
def configure_apk(args):
@ -177,11 +177,14 @@ def configure_apk(args):
def set_user(args):
"""
Create user with UID 1000 if it doesn't exist
Create user with UID 10000 if it doesn't exist.
Usually the ID for the first user created is 1000, but higher ID is
chosen here to avoid conflict with Android UIDs/GIDs.
"""
suffix = "rootfs_" + args.device
if not pmb.chroot.user_exists(args, args.user, suffix):
pmb.chroot.root(args, ["adduser", "-D", "-u", "1000", args.user],
pmb.chroot.root(args, ["adduser", "-D", "-u", "10000", args.user],
suffix)
for group in pmb.config.install_user_groups:
pmb.chroot.root(args, ["addgroup", "-S", group], suffix,
@ -238,7 +241,7 @@ def copy_ssh_keys(args):
pmb.helpers.run.root(args, ["chmod", "700", target])
pmb.helpers.run.root(args, ["cp", authorized_keys, target + "/authorized_keys"])
pmb.helpers.run.root(args, ["rm", authorized_keys])
pmb.helpers.run.root(args, ["chown", "-R", "1000:1000", target])
pmb.helpers.run.root(args, ["chown", "-R", "10000:10000", target])
def setup_keymap(args):