From owner-freebsd-arch@freebsd.org Thu Nov 7 18:10:52 2019 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C85671BBCAB for ; Thu, 7 Nov 2019 18:10:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 478BKR2md2z44C4 for ; Thu, 7 Nov 2019 18:10:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id m16so2804457qki.11 for ; Thu, 07 Nov 2019 10:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=QIJbdfCKcQcfiRGqypqKTKTKDFLh73/MCdpRQLtvRmY=; b=XqnQGHwQU3MabOE7dUB7vHLTmVPXRd6hrSTlsq+B1Qg+ShscjFj+ks/w1rifs3IDDL cpcuRqwlB+qyzf1WeJmJUpLIk/Emg2nJ6CpUsYTpDKFAZSgh7TV+OnBrk2B7fY0+UbdB 64N3RYNrIb6K8Yg3KbjSTN/3S/OR+DzSSrjB4LCMdlpJKjpz1UDKz1E8jL2W4fA6kcJu JGjWguXfRMM8thLomKLZxoA0GXInD/nyuu1ZLh7pv/6FIuiN8Q1p7tKcb3WS9eJp1fz5 nSTQrZLE3QCzxZUc65ba3xcxZ7TuielyJ9tlPW/DVDMLqqGdihnGb7aAiepZ1ih3Wlre HIpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QIJbdfCKcQcfiRGqypqKTKTKDFLh73/MCdpRQLtvRmY=; b=I9zkRKFFnOdSzHPJ5WmN6DXVGFBQ/IZjcI22HXe7B3P4myNJQfJtwvRTKL1l4z4H6K 9viu3i+8Dz8wBCIScNusnKvKyLUUeWFCOiE8xh6HIBCJWom+WTYWbqBrdxpPgBBCokMB +ySmbv/BcUSDkHHUIa4Tr9wokU5V9ggVPO5bKwewSmB95VxseWwLqoDns3+JqsnfmHbf hzhQru7zmj11lUMSD56KEX92kSAf/Ho2jUYqVbMBLmlne2T9u/y94ABOJJRjKzCUtpaq POBatLLrpxcTMGPqjkkYnRqTYTP2xWGRlKl3WSNDlSr+0a/blQ2ERIIlD+ouGGSp8MYT 2vqA== X-Gm-Message-State: APjAAAXKmNZgypZzh28ZksOw8qJvtH5ySukIhULC7sGA0xsnG+NCPA1X AEGXEhlO7QoE55KKeo00zJxar8kOExiHUwTDnE7tvW3Jrphr0w== X-Google-Smtp-Source: APXvYqw5sdo4olF0I6AjlsQIDgPTOpV1Cln0S2YUBhtF9PVU/ZkzCcWMFc/dwlO6OqPN8T7OCqksz8Pf+gFjkWMoqNg= X-Received: by 2002:a37:b0c5:: with SMTP id z188mr4299530qke.215.1573150249618; Thu, 07 Nov 2019 10:10:49 -0800 (PST) MIME-Version: 1.0 From: Warner Losh Date: Thu, 7 Nov 2019 11:10:38 -0700 Message-ID: Subject: Creating /etc/os-release To: "freebsd-arch@freebsd.org" X-Rspamd-Queue-Id: 478BKR2md2z44C4 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=XqnQGHwQ; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.73 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arch@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[13]; RCPT_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; TO_DN_EQ_ADDR_ALL(0.00)[]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.73)[ip: (-9.24), ipnet: 2607:f8b0::/32(-2.35), asn: 15169(-2.01), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 18:10:52 -0000 Greetings, A standard has evolved in other communities to communicate certain key aspects of the system to interested parties. The /etc/os-release file. The standard is defined here http://0pointer.de/blog/projects/os-release and here https://www.freedesktop.org/software/systemd/man/os-release.html . It has become a de-facto standard for the graphical systems. FreeBSD currently tries to address this with a port sysutils/etc_os-release, but there's a number of issues with it, see for example https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238953. The biggest issue being that we can't install a static file: it has to change as the system is updated. To that end, I propose the following: First, we create a /etc/os-release symlink to /var/run/os-release. This will place the file in the standard place, but allow its generation on each boot in a friendly to read-only-root manner. Second, we create a /etc/rc.d/os-release script that will populate /var/run/os-release. Since this is a standard rc script, we can allow people to opt-out of generating this file in a standardized way (although it contains information that's available to anybody on the system, some reduced configurations may not have all the scripts / programs used to generate it). If the file isn't generated, then opening it will return the same not found error as before. Since this is a symlink, it's friendly to etcupdate / mergemaster updating schemes. Finally, we'd obsolete the port since it is flawed anyway. I opted for every boot rather than a file in /etc that gets generated as part of mergemaster / etcupdate because it's more robust (the change happens right away, and works in all environments, even if /etc isn't updated). The amount of work here is tiny as well, so all but the most demanding of users won't notice it at all. While this does come from the Linux community, it has become a de-facto standard. DragonflyBSD has it, for example, since 9c172c37, but their implementation is flawed for us to use directly since it creates it at installworld time and we don't touch /etc as part of installworld. We also have a port, but there's enough flaws in the port approach that we should just make this be part of the base system to place nicely with software that expects it today. It also means we don't need hacks for freebsd-update. Finally, since this change is additive, we can also MFC it to 12. I've created a change that I think covers all these aspects. Please see https://reviews.freebsd.org/D22271 for the specifics. Comments about the code should go there, while comments about the plan should go here. Warner