Commit graph

98 commits

Author SHA1 Message Date
Clayton Craft
bca632d4f6
postmarketos-base: enable using zram swap by default (MR 3752)
This installs zram-init and sets it to start on boot for all
devices/UIs. The included conf.d/zram-init also allows diabling using
zram swap or overriding the size by using a deviceinfo var.

I did an analysis of the pmos base install size with the 'none' UI
selected, after depending on zram-init, and the following new package is
installed:
        zram-init-11.1-r1 installed size: 40 KiB

These packages are dependencies of zram-init, however they are already
installed in the base image (with 'none' UI) so they are not counted
above:
        util-linux-misc-2.38.1-r0 installed size: 6816 KiB
        e2fsprogs-extra-1.46.5-r4 installed size: 1324 KiB

So this seems like a very small price to pay for the benefit of not
making the logic/implementation more complicated than this.

     * Starting busybox syslog ... [ ok ]
    ssh-keygen: generating new host keys: RSA ECDSA ED25519
     * Starting sshd ... [ ok ]
    zram swap: activating with size: 243 MB
     * Loading zram module...
     [ ok ]
     * Swap->zram0
     [ ok ]
     * Starting local ... [ ok ]

This change introduces one new deviceinfo variable:
deviceinfo_zram_swap_pct: percentage of RAM to use for zram swap

Default percentages if the second var is unset are explained in the
zram-init file this commit adds. A value of 0 disables zram swap.

fixes #1133
2023-01-11 15:39:40 +01:00
Elagost
fd90572c61
postmarketos-base: replace sudo with cmd:sudo (MR 3721)
[ci:skip-build] already built successfully in CI
2022-12-18 13:23:33 -08:00
Raymond Hackley
d6cb995b99
main/postmarketos-base: add regulator-haptic udev rules (MR 3691)
Add rules for regulator-haptic, which is used on:
- samsung-e5/e7
- samsung-cprime/gprime
- samsung-j3/j5(x)

Note that regulator-haptic is not supported on some devices yet,
and samsung-e5 is not ported at the moment.

[ci:skip-build]: already built successfully in CI
2022-12-07 09:46:19 +01:00
Anjandev Momi
7270f472e3
treewide: fix tabs, final newline, trailing whitespace (MR 3530) 2022-10-16 16:27:22 +02:00
Minecrell
5f140538bf
main/postmarketos-base: install mesa-dri-gallium only if needed (MR 3478)
At the moment almost all device packages force installation of the Mesa
drivers, even when they are not used by any application (for example on
a minimal headless installation with "none" or "console" UI).
Omitting mesa-dri-gallium from such installations saves about ~150 MiB
of disk space (469 MiB -> 317 MiB rootfs for minimal installation on
arrow-db410c).

The "classic" drivers have been removed from Mesa so only one mesa-dri-
package exists now: mesa-dri-gallium contains all Mesa drivers,
llvmpipe, freedreno, lima, panfrost, Intel (iris/crocus), ...

This means we can easily create an install_if package in
postmarketos-base that installs that driver package only if needed
(= only if another package requires the "mesa" package).

Strictly speaking the install_if could be restricted further since
mesa-dri-gallium is only needed by "mesa-egl", "mesa-gbm" and "mesa-gl"
but not e.g. the Vulkan drivers. Having three postmarketos-base
subpackages (one install_if for each of them) seems a bit
overengineered, though. "mesa" is a common dependency of all three
of them, so using install_if="... mesa" should be good enough.
2022-10-11 11:19:30 +02:00
Newbyte
f2c7c48e2a
main/postmarketos-base: make apk interactive by default (MR 3444)
This would mitigate issues where apk unexpectedly replaces packages
somewhat as this way the user will be able to see precisely what changes
will happen to their system before they are committed. Furthermore, most
users are likely accustomed to package managers like apt, dnf, pacman,
among others that all are interactive by default and as such this would
provide a more familiar experience for them.

This will not affected pre-existing installs, and advanced users who
do not like this behaviour can restore the old one by deleting
/etc/apk/interactive.

[ci:skip-build]: already built successfully in CI
2022-09-28 09:18:55 +02:00
Dylan Van Assche
8c291862b6
main/postmarketos-base: add replace for busybox-openrc (MR 3400)
Alpine refactored the Busybox APKBUILD which resulted into a few
renamings like busybox-initscripts to busybox-openrc.

See 8b30ff10ab
2022-09-04 12:58:15 +02:00
David Wronek
2e11baa90d
main/postmarketos-base: Add alpine-release to replaces (MR 3372)
Upstream changed the alpine-base package. Conflicting files are now in
alpine-release instead of alpine-base.
2022-08-20 21:47:39 +02:00
Dylan Van Assche
a3f7bf3e1a
main/postmarketos-base: use setup-devd (MR 3302)
Alpine does not use setup-udev anymore and provides the same
functionality through setup-devd. The setup-udev script was deleted [1]
but postmarketos-base still used it and caused pmbootstrap to fail when
building a device image. Use the rc-service setup directly from
setup-devd.

[1] b56c4c2b9d
2022-07-20 10:05:27 -04:00
Jakob Hauser
b6f19a2ed7
main/postmarketos-base: remove udev rule for rt5033 battery refresh (MR 3223)
The refresh method was removed in UPower version 0.99.18 for regular
usage (available in debug mode only).
2022-06-12 15:44:47 +02:00
Jack Knightly
4912e44aa3
main/postmarketos-base: modify tm2-touchkey udev rule for midas (MR 3192) 2022-06-09 08:08:41 +02:00
Raymond Hackley
ab83b8cbeb
main/postmarketos-base: udev rule for zinitix touchkey (MR 3015)
The udev file "20-zinitix-input.rules" maps the touchkey on Zinitix-TS to
KEY_MENU and KEY_BACK.
2022-03-21 22:25:54 +09:00
Raymond Hackley
9833cc8a64
samsung-{a3,a5,a7,klte,serranove}: move tm2-touchkey rules to pmos-base (MR 2926)
Fixes: #1422
2022-03-03 19:21:20 +03:00
Alexey Min
432627c921
main/postmarketos-base: fix error after upstream changes (MR 2970)
Fixes error: postmarketos-base-18-r0: trying to overwrite etc/fstab owned by alpine-baselayout-data-3.2.0-r20.

caused by 9ecba8a514

[ci:skip-build] already built successfully in CI
2022-03-02 16:12:10 -08:00
Clayton Craft
caec14561d
postmarketos-base: add sysctl config to disable rp_filter on ipv4 (MR 2943)
MMS support (via mmsd-tng) involves sending/receiving network
requests/responses over the wwan interface. If it's ipv4-only and the
device is connected to some other ipv4 network on another iface (like
wifi), this can cause the rp_filter to reject responses on wwan iface
because it incorrectly thinks they are martian packets.

This does theoretically disable some "security" feature in the kernel,
but it's worth noting that:

1) rp_filter isn't implemented at all in the kernel for ipv6

2) other distros (mobian, pureos at least) are also disabling rp_filter

3) this seems to be a relatively common problem with folks using mms on
   pmOS, since many carriers' data networks are ipv4-only

also see:
https://gitlab.com/kop316/mmsd/-/merge_requests/55/diffs?commit_id=b22c253fb939ff1eb949ea4e628706e6a28c851a

[ci:skip-build] already built successfully in CI
2022-02-16 12:08:24 -08:00
Luca Weiss
8aa04780b2
main/postmarketos-base: set distro logo in /etc/os-release (MR 2867)
With this apps like gnome-control-center will display the postmarketOS
logo instead of the default GNOME logo.
2022-01-21 01:09:59 +00:00
Clayton Craft
84b6b9a956
main/postmarketos-base: clear /tmp on boot (MR 2744)
This configures bootmisc to clear /tmp on bootup. I think most folks
expect distros to do this, many even mount /tmp as tmpfs. I don't think
that's a great idea in pmOS since RAM is usually limited on many
devices. So this, clearing it on boot, seems like a reasonable compromise.

Fixes #1342
2021-12-19 20:32:43 +03:00
Minecrell
74e8166c7d
main/postmarketos-base: fix file permissions of /etc/sudoers (MR 2610)
Installing postmarketos-base currently changes the file permissions
of /etc/sudoers:

  # apk add sudo
  # stat /etc/sudoers
  Access: (0440/-r--r-----)  Uid: (    0/    root)   Gid: (    0/    root)

  # apk add postmarketos-base
  # stat /etc/sudoers
  Access: (0044/----r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

The file mode 0044 decodes to:
  - User *cannot* read
  - Group can read
  - Other can read

which does not make any sense. The "sudoers" man page makes it very
clear that this file should have a file mode of 0440 [1]
("readable by owner and group, writable by none").

This looks like a bad typo. However, given that only read permissions
were given out this shouldn't have major security implications
(except allowing all users to see who can use sudo).
Install the file with 0440 instead of 0044 to fix this:

  # apk add postmarketos-base
  # stat /etc/sudoers
  Access: (0440/-r--r-----)  Uid: (    0/    root)   Gid: (    0/    root)

[1]: https://www.sudo.ws/man/1.9.8/sudoers.man.html#Error_log_entries
2021-10-17 11:30:07 +02:00
Martijn Braam
0a4645eaec
main/postmarketos-base: depend on the keys package (MR 2477)
Have the keys be packagemanaged by default instead of preloading it
once with pmbootstrap
2021-09-01 11:37:15 +03:00
Jakob Hauser
4baa805b41
main/postmarketos-base: change permission on tm2-touchkey leds (MR 2380)
Allow users in group "input" to control the tm2-touchkey leds.

Additionally correcting the udev rule for disabling the tm2-touchkey leds by default.

[ci:skip-build] already built successfully in CI
2021-08-10 00:03:50 -07:00
Jakob Hauser
bd85700dea
main/postmarketos-base: udev tm2-touchkey and rt5033-battery (MR 2330)
The udev file "20-tm2-touchkey-leds.rules" disables the leds of
tm2-touchkey by default because they are in an unconfigured state.

The udev file "95-rt5033-battery-refresh.rules" triggers a refresh
of the rt5033-battery information within UPower 5 secs after
initialization. This avoids a wrong battery icon after boot.

The udev file "50-firmware.rules" was moved from /etc/udev/rules.d
to /lib/udev/rules.d.

Related: https://wiki.postmarketos.org/wiki/Packaging#Device_specific_quirks
2021-07-11 14:10:03 +02:00
Clayton Craft
4136eeae5a
postmarketos-base: add nofde subpackage (MR 2278) 2021-06-26 16:28:08 -07:00
Clayton Craft
92e43e8324
postmarketos-base: remove UI-specific config/dependencies (MR 2243)
These will be included in a new postmarketos-base-ui package
2021-06-23 13:00:00 +02:00
Clayton Craft
a83a0a0726
postmarketos-base: add nftables as dependency (MR 2060)
This enables the firewall by default, and could be split off into a
future ui-base package so that the firewall (among other things) are
enabled only when UIs are installed.
2021-06-14 14:30:50 -07:00
Ignacy Kuchciński
7fb10635e0
main/*: fix outdated url variables (MR 2226)
[ci:skip-vercheck]
2021-06-06 19:02:54 +02:00
Dylan Van Assche
5e562fdbc6
main/postmarketos-base: add pulseaudio config
Automatically switch to a connected USB or
Bluetooth audio device and duck the main volume
when a notification is received.
2021-06-02 18:58:04 +02:00
Oliver Smith
f3b949296d
main/postmarketos-base: alsa playing -> no inhibit (MR 2216)
Don't suspend the device while alsa is playing. I ran this for two days
in combination with suspend time set to 1 min on the pinephone and it
works great. Finally no suspend while VLC is playing podcasts.
2021-06-02 01:26:47 +02:00
Bart Ribbers
9387842aec
main/postmarketos-base: remove networkmanager from depends (MR 2174) 2021-05-24 11:39:07 +02:00
Dylan Van Assche
8330d2a552
main/postmarketos-base: add dependency on wireless-regdb (MR 1974)
CRDA in the kernel requires a regulatory database to be available
to configure the WiFi card correctly following the regulations in
each possible environment.
2021-02-23 14:54:49 +01:00
Martijn Braam
f099d73fc8
main/postmarketos-base: update motd for the cheatsheet (MR 1961) 2021-02-21 11:47:07 +01:00
Oliver Smith
6e7b75abb5
main/postmarketos-base: add dummy post-upgrade (MR 1964)
Add post-upgrade file with a warning, so we don't symlink it to the
post-install script.
[ci:skip-vercheck]: no need to rebuild the package

Related: build.postmarketos.org#85
2021-02-17 17:49:58 -08:00
Oliver Smith
e4ef9fba72
main/postmarketos-base: retire devmappings service (MR 1820)
Remove devmappings service. The original purpose of this service was to
ensure that /boot is mounted properly after the initramfs passed control
to OpenRC, because the initramfs used to umount /boot before that. With
/etc/fstab alone, /boot get not get mounted with subpartitions (which we
use on Android devices), if util-linux >= 2.33 was installed (MR 115).

Nowadays, we don't umount /boot in the initramfs before passing control
to OpenRC anymore (MR 1398). So this service isn't needed anymore, and
prevented the previous pmOS_inst_boot <> pmOS_boot patch from working
correctly.
2021-01-27 16:12:27 +01:00
Martijn Braam
3ac6f21c6c
main/postmarketos-base: ship os-release (MR 1522)
Ship the /etc/os-release file from the postmarketos-base package instead
of having it generated by pmbootstrap.
2021-01-07 23:42:49 +01:00
clayton craft
5a06a6bb06
postmarketos-base: replace elogind suspend hook with sleep-inhibitor (MR 1825)
This adds sleep-inhibitor as a dependency when elogind is present, and
installs a conf for it with some plugins enabled that are beneficial to
devices running pmOS. The elogind suspend hook is dropped.

This resolves issues where suspend is aborted in the hook *after*
PrepareForSleep is sent over dbus (which might cause some things to
disable radios/modems, etc for suspend).

The 'period' in the conf is in minutes, a value of 0.1 is 6 seconds,
which seems reasonable for releasing the lock when conditions for
inhibiting no longer apply, without spinning the CPU too frequently.
2020-12-28 00:36:35 +01:00
Oliver Smith
f430dae13b
main/postmarketos-base: add tinydm config (MR 1795)
Set postmarketOS default UID in tinydm config, so tinydm can be
upstreamed to Alpine without hardcoding the pmOS default UID in the
tinydm packaging.
2020-12-07 18:21:28 -08:00
Oliver Smith
8b7adeddf3
main/postmarketos-base: remove post-install config overrides (MR 1713)
Do not change config files in post-install scripts anymore (with sed
commands or by other means). Instead, ship the files inside the packages
and use "replaces", so apk allows the package to overwrite files from
other packages:
https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#replaces

Notes on specific files:
* /etc/elogind/logind.conf: original file only consists of commented out
  compile defaults. Copy them over for now. In the future we should be
  able to install our own config into a .d directory, without all the
  comments: 8358fc5950
* /etc/fstab: original file only has /dev/cdrom and /dev/usbdisk
  entries, which are not useful for postmarketOS:
  https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/alpine-baselayout/APKBUILD
* /etc/motd: reformat the text, add link to the chat
* /etc/conf.d/syslog: original file only contained 'SYSLOGD_OPTS="-t"',
  make the override file as if the sed statement from post-install was
  executed
* /etc/wpa_supplicant/wpa_supplicant.conf: post-install script touches
  this file. We probably added it back in 2017 in relation to enabling
  D-Bus (though the PR does not mention it explicity), but at least with
  the current init.d script of NetworkManager, we can simply have '-u' in
  wpa_supplicant_args:
  https://github.com/postmarketOS/pmbootstrap/pull/578
  https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/wpa_supplicant/wpa_supplicant.initd
* /etc/sudoers: base on original /etc/sudoers, but remove all the
  commented out stuff except for the visudo note at the top. We could
  also put a file in /etc/sudoers.d, but since the wheel line is present
  in the original /etc/sudoers and only commented out, it would be kind
  of unexpected to enable it in a file in /etc/sudoers.d. I prefer this
  stripped down version of the file, that is easy to read.
2020-12-03 13:11:03 +01:00
Oliver Smith
c8a79d6fa6
main/postmarketos-base: fix install_if for subpkgs (MR 1713)
Instead of install_if="$pkgname xorg-server" etc, it should be
install_if="$pkgname=$pkgver-r$pkgrel xorg-server".

Reference: https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#install_if
2020-12-03 13:11:03 +01:00
Oliver Smith
0105a1d8ef
main/postmarketos-base: put full path in filenames (MR 1713)
Refactor the install code to be generic, so we only need to add the new
path in one place when adding a new file. Put the full path into the
filename to make this possible.

I've tried to mimic the final directory structure in the aport first
(e.g. $pkgdir/sbin/swapfile -> main/postmarketos-base/sbin/swapfile),
but that leads to conflicts as abuild only takes the filename for
checksums (conflict with etc/conf.d/swapfile):
https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10013

We don't really need checksum verification for the files shipped in the
same directory (not downloaded), but nevertheless this is a bug. It
leads to confusing behavior and might be fixed by letting abuild demand
that there is only one source file with the same name, as I suggested in
the issue linked above. So let's avoid this altogether with the flat
file name.
2020-12-03 13:11:03 +01:00
clayton craft
c37012a909
postmarketos-base: add elogind hook to conditionally cancel suspend (MR 1665)
This hook will cancel a suspend if:
        - There's an open ssh connection to the system
        - apk database is locked
2020-11-13 00:33:31 -08:00
clayton craft
81fc6a0bed
postmarketos-base: enable rfkill service (MR 1693)
This enabled the rfkill service, part of util-linux, that saves/restores
radio device state on shutdown/boot.

fixed #836
2020-11-09 15:09:32 +01:00
Bart Ribbers
aced152afc
main/postmarketos-base: depend on dnsmasq (MR 1438)
dnsmasq is required by NetworkManager for WiFi Hotspot to work.
2020-08-23 12:31:22 +02:00
Bart Ribbers
7b58ed7fce
main/postmarketos-base: stop the power key from shutting down devices (MR 1499)
Pressing power button should not power off a device. Although it is
expected on desktops and laptops, it isn't expected on phones and
tablets. Instead it should just turn off the screen or go into a deep
sleep, but that isn't handled by elogind. So let elogind just ignore the
button altogether.

Also re-order the dependencies alphabetically while we're touching the
package anyway
2020-08-22 22:41:41 +02:00
Oliver Smith
784782f543
main/postmarketos-base: keep /etc/fstab (MR 1398)
Only add a comment, do not try to mount the root or boot partitions
anymore. The initramfs is doing this already.

Related: https://postmarketos.org/fstab
2020-07-08 18:02:49 +02:00
Oliver Smith
58ae4df2ef
main/postmarketos-base: rm write_unless_modified (MR 1398)
Get rid of the "write_unless_modified" code, which was supposed to only
change /etc/fstab, /etc/issue, /etc/motd if the user did not modify it.

This is nice in theory, but we have a bug report where the code did not
do what it should (apk audit possibly failed due to a qemu bug?), and
then it lead to strange bugs related to not having the expected
/etc/fstab installed.

Fixes: #661, #258
2020-07-08 18:02:49 +02:00
Federico Amedeo Izzo
b6ea0ba1de
{nokia-n900,samsung-i9070}: move swclock initial timestamp back to postmaketos-base.post-install (MR 1166) 2020-05-23 17:57:40 +02:00
Federico Amedeo Izzo
859772a915
*/*: add missing exit 0 in post-install scripts (MR 1166) 2020-05-23 17:57:36 +02:00
Federico Amedeo Izzo
0e502a5139
postmarketos-base: disable swclock for all devices, enable it for nokia-n900 and samsung-i9070 (MR 1166) 2020-05-23 17:57:27 +02:00
Luca Weiss
e350b00b9b
treewide: chmod -x files (MR 1237)
We don't want executable APKBUILDs, deviceinfo files, etc in pmaports.
Remove the executable bit from those files.

[ci:skip-build]
[ci:skip-vercheck]
2020-05-23 17:29:18 +02:00
Bart Ribbers
98f9320f35
main/postmarketos-base: remove unnecessary dependencies (!1018)
These dependencies don't belong here.
- iw: should be installed by the user themselves when wanted
- nano: should be installed by the user themselves when wanted
- pulseaudio: should be installed by the UI meta packages that need it
  instead
- pulseaudio-alsa: should automatically be installed when both
  PulseAudio and alsa are installed

https://gitlab.alpinelinux.org/alpine/aports/merge_requests/4820
2020-03-03 21:39:27 +03:00
Pops Dylan
7b7c1db0ff
main/postmarketos-base: remove initstepslew from chrony configuration (!838)
Comment out the initstepslew line in /etc/chrony/chrony.conf.
initstepslew can delay booting while chrony sets the time. The
makestep 1 -1 line in the configuration also causes chrony to step
the time (whenever the offset is greater than 1s), making
initstepslew redundant.
2019-12-30 18:34:14 +01:00