From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AC5F015810F for ; Fri, 9 Jun 2023 07:20:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F0B86E0729; Fri, 9 Jun 2023 07:20:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D4E24E0729 for ; Fri, 9 Jun 2023 07:20:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 03ACE3408B8 for ; Fri, 9 Jun 2023 07:20:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 62562A82 for ; Fri, 9 Jun 2023 07:20:25 +0000 (UTC) From: "Leonardo Hernandez" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Leonardo Hernandez" Message-ID: <1686295215.6a6e0013d14ed626692045b82795de5a41ccfba8.leohdz172@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: www-apps/code-server-bin/, www-apps/code-server-bin/files/ X-VCS-Repository: repo/proj/guru X-VCS-Files: www-apps/code-server-bin/code-server-bin-4.13.0-r1.ebuild www-apps/code-server-bin/files/code-server-bin.conf www-apps/code-server-bin/files/code-server-bin.rc X-VCS-Directories: www-apps/code-server-bin/ www-apps/code-server-bin/files/ X-VCS-Committer: leohdz172 X-VCS-Committer-Name: Leonardo Hernandez X-VCS-Revision: 6a6e0013d14ed626692045b82795de5a41ccfba8 X-VCS-Branch: dev Date: Fri, 9 Jun 2023 07:20:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a22be108-8f9f-497f-a76c-df691ea29d27 X-Archives-Hash: a640bf0f3272425f666aece6e642ef84 commit: 6a6e0013d14ed626692045b82795de5a41ccfba8 Author: Leonardo Hernández Hernández proton me> AuthorDate: Fri Jun 9 07:19:25 2023 +0000 Commit: Leonardo Hernandez proton me> CommitDate: Fri Jun 9 07:20:15 2023 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6a6e0013 www-apps/code-server-bin: add OpenRC init script Closes: https://bugs.gentoo.org/907847 Signed-off-by: Leonardo Hernández Hernández proton.me> .../code-server-bin-4.13.0-r1.ebuild | 105 +++++++++++++++++++++ .../code-server-bin/files/code-server-bin.conf | 13 +++ www-apps/code-server-bin/files/code-server-bin.rc | 47 +++++++++ 3 files changed, 165 insertions(+) diff --git a/www-apps/code-server-bin/code-server-bin-4.13.0-r1.ebuild b/www-apps/code-server-bin/code-server-bin-4.13.0-r1.ebuild new file mode 100644 index 000000000..35845168a --- /dev/null +++ b/www-apps/code-server-bin/code-server-bin-4.13.0-r1.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +MY_PN="${PN/-bin/}" +MY_P="${MY_PN}-${PV}" +BASE_URI="https://github.com/coder/${MY_PN}/releases/download/v${PV}/${MY_P}-linux" + +inherit systemd + +DESCRIPTION="VS Code in the browser (binary version with unbundled node and ripgrep)" +HOMEPAGE="https://coder.com/" +SRC_URI=" + amd64? ( ${BASE_URI}-amd64.tar.gz ) + arm64? ( ${BASE_URI}-arm64.tar.gz ) +" +RESTRICT="test" +LICENSE="MIT 0BSD ISC PYTHON BSD-2 BSD Apache-2.0 Unlicense LGPL-2.1+ + || ( BSD-2 MIT Apache-2.0 ) + || ( MIT WTFPL ) + || ( BSD GPL-2 ) +" +SLOT="0" +KEYWORDS="~amd64 ~arm64" + +RDEPEND=" + ${DEPEND} + >=net-libs/nodejs-16.0.0[ssl] + sys-apps/ripgrep + app-crypt/libsecret +" + +S="${WORKDIR}/${MY_P}-linux-${ARCH}" + +PATCHES=( "${FILESDIR}/${PN}-node.patch" ) + +DOCS=( "LICENSE" "README.md" "ThirdPartyNotices.txt" ) + +QA_PREBUILT="*" + +# Relative +VSCODE_MODULES="lib/vscode/node_modules" + +QA_PRESTRIPPED=" + opt/${PN}/node_modules/@node-rs/argon2-linux-x64-musl/argon2.linux-x64-musl.node + opt/${PN}/${VSCODE_MODULES}/@parcel/watcher/prebuilds/linux-x64/node.napi.musl.node + opt/${PN}/${VSCODE_MODULES}/@parcel/watcher/prebuilds/linux-x64/node.napi.glibc.node +" + +src_prepare() { + default + + # We remove as much precompiled code as we can, + # node modules not written in JS cannot be removed + # thus "-bin". + + # use system node + rm ./lib/node || die "Failed to remove bundled nodejs" + + # remove bundled ripgrep binary + rm ./"${VSCODE_MODULES}"/@vscode/ripgrep/bin/rg \ + || die "Failed to remove bundled ripgrep" + + # Only required at build time + find "${S}" -type l -name python3 -delete || die + + # not needed + rm ./postinstall.sh || die + + # For windows + rm -r ./"${VSCODE_MODULES}"/@parcel/watcher/prebuilds/win32-x64 || die + + if [[ $ELIBC != "musl" ]]; then + rm ./"${VSCODE_MODULES}"/@parcel/watcher/prebuilds/linux-x64/node.napi.musl.node || die + elif [[ $ELIBC != "glibc" ]]; then + rm ./"${VSCODE_MODULES}"/@parcel/watcher/prebuilds/linux-x64/node.napi.glibc.node || die + rm ./"${VSCODE_MODULES}"/@parcel/watcher/prebuilds/darwin-x64/node.napi.glibc.node || die + rm ./"${VSCODE_MODULES}"/@parcel/watcher/prebuilds/darwin-arm64/node.napi.glibc.node || die + fi + + rm -r ./lib/vscode/extensions/node_modules/.bin || die +} + +src_install() { + einstalldocs + + insinto "/opt/${PN}" + doins -r . + fperms +x "/opt/${PN}/bin/${MY_PN}" + dosym -r "/opt/${PN}/bin/${MY_PN}" "/opt/${PN}/bin/${PN}" + dosym -r "/opt/${PN}/bin/${PN}" "${EPREFIX}/usr/bin/${PN}" + + dosym -r "/usr/bin/rg" \ + "${EPREFIX}/opt/${PN}/${VSCODE_MODULES}/@vscode/ripgrep/bin/rg" + + systemd_douserunit "${FILESDIR}/${PN}.service" + newinitd "${FILESDIR}/${PN}.rc" "${PN}" + newconfd "${FILESDIR}/${PN}.conf" "${PN}" +} + +pkg_postinst() { + elog "When using code-server systemd service run it as a user" + elog "For example: 'systemctl --user enable --now code-server'" +} diff --git a/www-apps/code-server-bin/files/code-server-bin.conf b/www-apps/code-server-bin/files/code-server-bin.conf new file mode 100644 index 000000000..336f7bc71 --- /dev/null +++ b/www-apps/code-server-bin/files/code-server-bin.conf @@ -0,0 +1,13 @@ +# /etc/conf.d/code-server-bin: config file for /etc/init.d/code-server-bin. +# This can also be used as multiplexed configuration, i.e. openrc-run +# looks for both /etc/conf.d/code-server-bin and /etc/conf.d/code-server-bin.. + +# Options to pass to code-server-bin. +# NOTE: if you want to run multiple instances, be make sure to change +# the port for each one (it is preferred to use the configuration file). +#command_args="--port 8080" + +# Specify the network service that corresponds to the "bind-addr" setting +# in your configuration file. For example, if you bind to 127.0.0.1, +# this should be set to "loopback" which provides the loopback interface. +rc_need="loopback" diff --git a/www-apps/code-server-bin/files/code-server-bin.rc b/www-apps/code-server-bin/files/code-server-bin.rc new file mode 100644 index 000000000..445f05a64 --- /dev/null +++ b/www-apps/code-server-bin/files/code-server-bin.rc @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 2023 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 or later + +NAME=${RC_SVCNAME%%.*} +USER=${RC_SVCNAME##*.} +PIDFILE_DIR=/run/${NAME}/${USER} + +description="Start code server in the background" +command="/usr/bin/${NAME}" +command_user="${USER}" +pidfile="${PIDFILE_DIR}/${NAME}.pid" +command_background=true + +depend() { + use logger dns +} + +checkconfig() { + if [ "${RC_VERSION:-0}" = "0" ]; then + eerror "This script cannot be used for baselayout-1." + return 1 + fi + + if [ "${USER}" = "${RC_SVCNAME}" ]; then + eerror "You have to create an init script for each user:" + eerror "ln -s emacs /etc/init.d/emacs." + return 1 + fi + + if ! id -u "${USER}" >/dev/null; then + eerror "${USER}: No such user" + return 1 + fi + + checkpath -d --owner 0 --mode 0755 "${PIDFILE_DIR%/*}" + checkpath -d --owner "${USER}" --mode 0755 "${PIDFILE_DIR}" +} + +start() { + local home + checkconfig || return 1 + + eval home="~${USER}" + + default_start +}