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.
This commit is contained in:
Pablo Castellano 2017-10-12 22:08:10 +02:00 committed by Oliver Smith
parent 34de4c899f
commit 114fdc0a68
12 changed files with 24 additions and 25 deletions

View file

@ -24,7 +24,6 @@ makedepends=""
install="$pkgname.post-install"
subpackages="$pkgname-x11"
source="
sudoers
firmwareload.sh
50-firmware.rules
swapfile/swapfile
@ -34,8 +33,6 @@ source="
options="!check"
package() {
install -D -m644 "$srcdir"/sudoers \
"$pkgdir"/etc/sudoers.d/postmarketos
install -D -m644 "$srcdir"/50-firmware.rules \
"$pkgdir"/etc/udev/rules.d/50-firmware.rules
install -D -m755 "$srcdir"/firmwareload.sh \
@ -65,10 +62,9 @@ x11() {
mkdir "$subpkgdir"
}
sha512sums="c6de3b44bc45b9f9c641a7e34c69a481ee39b99ac0251cd28f2b3aae49c1a8d1ca448f4936b7942b1a8b8f7c18a5415c938098765ed8cf08456543800160e64b sudoers
38dc75c0ed32b76dccd3d8e7e8173e8b7d91847cf2b07123f376b95af46b4f89798b24f45302a0726fdc1cf253aecaac140f431735ac5c6511553f790badd0af firmwareload.sh
sha512sums="38dc75c0ed32b76dccd3d8e7e8173e8b7d91847cf2b07123f376b95af46b4f89798b24f45302a0726fdc1cf253aecaac140f431735ac5c6511553f790badd0af firmwareload.sh
0b098828080055d3646ea54891cb0e1b578cbc30f5e16f7284f2814c08192f18079a38fb686d192715ae6a3d2cd6625d9e3cf99f234a6f0d94088bb0cb2ce43d 50-firmware.rules
3ceeee37f558e7c95ad973692b6a437f997e6b46c3d1c2257ddfb1529a5633477373aa123c7f08164e818daae50acb203d151379f27ca11bd458809e6a0d4de7 swapfile
f5cc0f1265955d2646e5f099dd4b5d4c287945bfc18c16044db57670d456f55c678fc11cc59e6dab3fa340832ce869d516302a3a35c13518539ed0cedca51819 swapfile.init
e0d2d48b82a03239a4c0a00acaf83e00d397c23a8d7c71053d4e2a383357c22dcedef9e81b0e12a1d7514e1fdbe0bb3eb82613d18b29034a7ce5447f13c84a53 swapfile.conf
8b022c5b45d02cbce64137e085838e7d7748b2f3c563faa1a1b02f91472cef96ad254f3f5ee35d80c982d80bd5959ceab0f8127534f7742134ca07a3d595be34 postmarketos-base.post-install"
4f00ad8ce8533fb884b083c094adada26ef845718a229e3ae94986997997297d9bec073babbe8829c29d28aaf31a01ebf28c041395ae7d8631be574b88059e34 postmarketos-base.post-install"

View file

@ -70,5 +70,9 @@ if ! grep -q Dwext /etc/conf.d/wpa_supplicant; then
fi
touch /etc/wpa_supplicant/wpa_supplicant.conf
# Enable the 'wheel' group
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
# Add user to video group for proper framebuffer permissions
usermod -a -G video user
username="$(getent passwd 1000 | cut -d ":" -f 1)"
usermod -a -G video "$username"

View file

@ -1,2 +0,0 @@
# Allow running all commands as root, when the user password is known
user ALL=(ALL) ALL

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-hildon
pkgver=1
pkgrel=0
pkgrel=1
pkgdesc="Lightweight desktop, optimized for single-touch touchscreen devices"
url="https://github.com/postmarketOS"
arch="noarch"
@ -29,6 +29,6 @@ package() {
install -D -m644 "$srcdir"/xinitrc_hildon.sh \
"$pkgdir"/etc/postmarketos-ui/xinitrc_hildon.sh
}
sha512sums="e50c2bd90ef7915278eb5071d3f3ce26794e620617a6d9b2c49a7a1df1da2809437e6d20387bbb61f2ae471c5610ad1e1a30db0d5272f081980764a7c06c221f start_hildon.sh
sha512sums="c75466e0a279da1aec11605b422c0a0d91a6fc38c27cdd819fb277badc84e220bbd8b87b217123b3801411aae0b93f98c6c0b449a5a33fc725bd6279a39d9741 start_hildon.sh
5ef5710bee7bde99e1f240eb8873239c452b55c6dc943930e181d091835824094cf56bf29ae1b34d792ba0ce27f76e30ea69f3c125dda3bf286eaaaba8c8e6ae xinitrc_hildon.sh
a091157afccf19d25dd86d52edf819435da01bb8933f45f5a207e4085b044b80e1790b5e2bb02dbd8f479fdf9d54b06d388a1a1a2995adf9da7d3000449a7f7f postmarketos-ui-hildon.post-install"
64007cebcfbb9d8cdc4db7f889722509e1090af0712802300611fb805e00e1de474e4e6b538d0d99be05ca25f983e94aab57e04b4cc8282ba0ae44609d1a7366 postmarketos-ui-hildon.post-install"

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="user"
autologin="$(getent passwd 1000 | 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)" = "12345" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
# Start X11 with Hildon
startx /etc/postmarketos-ui/xinitrc_hildon.sh > ~/x11.log 2>&1

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-weston
pkgver=3
pkgrel=0
pkgrel=1
pkgdesc="Meta package for weston"
url="https://github.com/postmarketOS"
arch="noarch"
@ -18,5 +18,5 @@ package() {
install -D -m644 "$srcdir"/start_weston.sh \
"$pkgdir"/etc/profile.d/start_weston.sh
}
sha512sums="1fb3dff37e7db7277f713958eeb9b9b8eae730aec2fe02d2c87d036d23b7f3a79779288f5ddf9a3b05465beea5410133fb4b0268b0544a07c08b9d53cdce4745 start_weston.sh
066071c0fa1b35079c28dc18ce66ac56575d49df06f1a217e308ea0b4587436e76432817091737eb9a17e7eecfc855d4d488e5850c77ccbaa3ee4e6a3949dbb8 postmarketos-ui-weston.post-install"
sha512sums="9281ec20d0367d11e8219cc248ebab94194c703fe87e3e4fcbd128d54a67f77d17781b006721a04e5bd3fd4a95616f22a79e88cbdc6d5cc29f86fcfb4fc07755 start_weston.sh
23958764613a14a49b300d7f4c6044fce75d8bdf23c2c5a6e9ffe7228a8fa2d0b2c8188dc0021f56f5c1bc6599d3691ede4e5a5c2a228a09bd7a804ae935bf29 postmarketos-ui-weston.post-install"

View file

@ -39,7 +39,7 @@ if [ ! -f $weston_config ]; then
fi
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="user"
autologin="$(getent passwd 1000 | 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"
@ -49,4 +49,5 @@ done
# Create weston-launch group and add user to it
[ $(getent group weston-launch) ] || groupadd weston-launch
usermod -a -G weston-launch user
username="$(getent passwd 1000 | 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)" = "12345" ] && [ $(tty) = "/dev/tty1" ]; then
if [ "$(id -u)" = "1000" ] && [ $(tty) = "/dev/tty1" ]; then
if test -n "${deviceinfo_weston_pixman_type}"; then
WESTON_OPTS=" --pixman-type=${deviceinfo_weston_pixman_type}"
fi

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-ui-xfce4
pkgver=0.0
pkgrel=1
pkgrel=2
pkgdesc="Meta package for xfce4"
url="https://github.com/postmarketOS/xfce4-phone"
arch="noarch"
@ -18,6 +18,6 @@ package() {
install -d -m755 "$pkgdir"/etc/skel
cp -a "${srcdir}/xfce4-phone-${pkgver}"/config "$pkgdir"/etc/skel/.config
}
sha512sums="6aa496acf16a5348050ed7aca07203f20f4663b37acd63255c31561e0931f90886050aa3c221db2224e3dc357fe5329dc703ec06f5938e7cea8606ad6b741ee6 start_xfce4.sh
86b0d3d83da393aafc5d17552457030d9dfae071a35dbe93125e101361962f1752575f17c7dd4140d2a5c6cd4e09367bb2226b532a0194c26c5a77899e80842f postmarketos-ui-xfce4.post-install
sha512sums="f51d88e1a4f8cd9156e62601c1b2ca40d3c6d7079480888471f21359f417398224722c42677cb28336efc8245d9b6b0851a2d1dc16b9f6c79d48ef284944b8b2 start_xfce4.sh
916f80ebd1ab86c17bb09158ca470bbc53c1fac53771a38e2422672c29cb07fd35906804a5b00eb852e6f1d08abaf31a6db13452765d1cceefc06c57479d3984 postmarketos-ui-xfce4.post-install
758562d2820a11b2c96e1805e00450f78203e6fd224115c373825f041b344985490a84b74d2880b423d5606140d5ffb41e79b0a8eb3e5b9a0ce7874c4ccfb666 postmarketos-ui-xfce4-0.0.tar.gz"

View file

@ -3,7 +3,7 @@
. /etc/deviceinfo
# Autologin on tty1, let busybox autoconfigure 2-6
autologin="user"
autologin="$(getent passwd 1000 | 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,5 +1,5 @@
if [ "$(id -u)" = "12345" ] && [ "$(tty)" = "/dev/tty1" ]; then
if [ "$(id -u)" = "1000" ] && [ "$(tty)" = "/dev/tty1" ]; then
startxfce4 > ~/x11.log 2>&1
# In case of failure, restart after 1s