Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package toolbox for openSUSE:Factory checked in at 2021-03-02 12:26:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/toolbox (Old) and /work/SRC/openSUSE:Factory/.toolbox.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "toolbox" Tue Mar 2 12:26:28 2021 rev:11 rq:875299 version:2.1+git20210226.daeb191 Changes: -------- --- /work/SRC/openSUSE:Factory/toolbox/toolbox.changes 2021-02-07 15:18:16.933693925 +0100 +++ /work/SRC/openSUSE:Factory/.toolbox.new.2378/toolbox.changes 2021-03-02 12:28:11.403463950 +0100 @@ -1,0 +2,22 @@ +Fri Feb 26 08:29:43 UTC 2021 - ku...@suse.com + +- Update to version 2.1+git20210226.daeb191: + * Set trap only after option parsing (#22) + +------------------------------------------------------------------- +Thu Feb 25 15:53:06 UTC 2021 - ku...@suse.com + +- Update to version 2.1+git20210225.5c541c8: + * Check sub{u,g}id if rootless, and fail early if they're not setup + * Fix creating a container with a specific name with `-c` + +------------------------------------------------------------------- +Mon Feb 08 09:03:18 UTC 2021 - ku...@suse.com + +- Update to version 2.1+git20210208.a720b25: + * Alleviate the need for zypper in the user toolbox script + * Consolidate logging and help debugging of the user toolbox's script + * Export machine-id and IPC inside the toolbox (IPC, user only) + * Fix (more) formatting... + +------------------------------------------------------------------- Old: ---- microos-toolbox-2.1+git20210203.a669e3a.tar.xz New: ---- microos-toolbox-2.1+git20210226.daeb191.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ toolbox.spec ++++++ --- /var/tmp/diff_new_pack.2pwoCj/_old 2021-03-02 12:28:12.519464948 +0100 +++ /var/tmp/diff_new_pack.2pwoCj/_new 2021-03-02 12:28:12.523464953 +0100 @@ -17,7 +17,7 @@ Name: toolbox -Version: 2.1+git20210203.a669e3a +Version: 2.1+git20210226.daeb191 Release: 0 Summary: Script to start a toolbox container for system debugging License: Apache-2.0 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.2pwoCj/_old 2021-03-02 12:28:12.555464981 +0100 +++ /var/tmp/diff_new_pack.2pwoCj/_new 2021-03-02 12:28:12.559464985 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/kubic-project/microos-toolbox.git</param> - <param name="changesrevision">e589434b4619773c676c7aef667f69b6d944da6b</param> + <param name="changesrevision">daeb191ea97061ee52b831ccd93442a2a7b00038</param> </service> </servicedata> \ No newline at end of file ++++++ microos-toolbox-2.1+git20210203.a669e3a.tar.xz -> microos-toolbox-2.1+git20210226.daeb191.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microos-toolbox-2.1+git20210203.a669e3a/toolbox new/microos-toolbox-2.1+git20210226.daeb191/toolbox --- old/microos-toolbox-2.1+git20210203.a669e3a/toolbox 2021-02-03 11:29:25.000000000 +0100 +++ new/microos-toolbox-2.1+git20210226.daeb191/toolbox 2021-02-26 09:27:41.000000000 +0100 @@ -16,8 +16,6 @@ set -eo pipefail -trap cleanup EXIT - # Defaults REGISTRY=registry.opensuse.org IMAGE=opensuse/toolbox @@ -77,12 +75,12 @@ container_runlabel return fi - # We want to do the user setup only when the container is created for the first time - [[ -n "${CREATE_AS_USER}" ]] && SETUP_USER=true + # We want to do the user setup only when the container is created for the first time + [[ -n "${CREATE_AS_USER}" ]] && SETUP_USER=true else echo "Container '$TOOLBOX_NAME' already exists. Trying to start..." echo "(To remove the container and start with a fresh toolbox, run: podman rm '$TOOLBOX_NAME')" - msg="start" + msg="start" fi local state @@ -100,16 +98,20 @@ echo "this may take some time. But this will only happen now that the toolbox is being created)" local tmp_user_setup tmp_user_setup=$(mktemp "${HOME}/.${TOOLBOX_NAME}-user-setup-XXXXXX.sh") + tmp_user_setup_log="/dev/null" + # DEBUG: uncomment the following line to see logs of the script in /tmp + #tmp_user_setup_log="/tmp/$(basename -- ${tmp_user_setup}).log" cat <<EOF > "${tmp_user_setup}" #!/bin/bash -groupadd -g ${USER_GID} ${USER_GNAME} &> /dev/null -useradd -M -N -g ${USER_GNAME} -u ${USER_ID} ${USER_NAME} &> /dev/null -getent group wheel >/dev/null || zypper install -y --no-recommends sudo system-group-wheel &> /dev/null -echo "%wheel ALL = (root) NOPASSWD:ALL" > /etc/sudoers.d/wheel 2> /dev/null -usermod -G wheel -a ${USER_NAME} &> /dev/null +groupadd -g ${USER_GID} ${USER_GNAME} +useradd -M -N -g ${USER_GNAME} -u ${USER_ID} ${USER_NAME} +if ! command -v sudo &> /dev/null ; then + zypper install -y --no-recommends sudo +fi +mkdir -p /etc/sudoers.d/ && echo "${USER_NAME} ALL = (root) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME} EOF ${SUDO} podman cp "${tmp_user_setup}" "${TOOLBOX_NAME}":"${tmp_user_setup}" - ${SUDO} podman exec --user root "${TOOLBOX_NAME}" bash "${tmp_user_setup}" + ${SUDO} podman exec --user root "${TOOLBOX_NAME}" bash "${tmp_user_setup}" &> "${tmp_user_setup_log}" ${SUDO} podman exec --user root "${TOOLBOX_NAME}" rm "${tmp_user_setup}" fi @@ -144,6 +146,17 @@ } image_pull() { + if [ -z ${SUDO} ]; then + if [ ! `grep $USER /etc/subuid` ] || [ ! `grep $USER /etc/subgid` ]; then + echo "$0: ERROR: rootless mode wanted but no subuid and/or subgid for user '$USER'" + echo " Toolbox will only work for this user if rootless podman is configured properly." + echo " consider doing something like this:" + echo " sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER" + echo " and then restart." + echo " Or use '-r', for using a rootfull container." + exit 1 + fi + fi ${SUDO} podman pull "$TOOLBOX_IMAGE" } @@ -159,7 +172,8 @@ --privileged \ --security-opt label=disable ${CREATE_AS_USER} \ --volume /:/media/root:rslave \ - --volume /dev:/dev:rslave \ + --volume /dev:/dev:rslave \ + --volume /etc/machine-id:/etc/machine-id:ro \ "$TOOLBOX_IMAGE" sleep +Inf 2>&1; then echo "$0: failed to create container '$TOOLBOX_NAME'" exit 1 @@ -275,10 +289,10 @@ ;; -u|--user) shift - MODE="user" + MODE="user" ;; -c|--container) - if [ -z "$TAG" ]; then + if [ -n "$TAG" ]; then echo "ERROR: Don't use both -c and -t!" show_help exit 1 @@ -321,6 +335,10 @@ esac done + # Don't call trap before, else we will cleanup stuff + # where nothing is to cleanup and report wrong error + trap cleanup EXIT + # Let's rebuild the image URI (this means that command # line, if present, overrides config file) TOOLBOX_IMAGE=$(echo "${REGISTRY}"/"${IMAGE}" | sed 's/^\///g') @@ -328,7 +346,7 @@ if [ "$MODE" = "user" ]; then USER_ID=$(id -u); USER_GID=$(id -g) USER_NAME=$(id -un) ; USER_GNAME=$(id -gn) - if [ -z "$CHANGE_NAME" ]; then + if [ -z "$CHANGE_NAME" ]; then TOOLBOX_NAME="${TOOLBOX_NAME}-user" fi @@ -339,7 +357,7 @@ test -d "${HOME}" && VOLUMES="$VOLUMES --volume ${HOME}:${HOME}" test -d "/run/user/${USER_ID}" && VOLUMES="$VOLUMES --volume /run/user/${USER_ID}:/run/user/${USER_ID}:rslave" test -d /run/media && VOLUMES="$VOLUMES --volume /run/media/:/run/media/:rslave" - CREATE_AS_USER="--pid host --userns=keep-id --user root:root $VOLUMES" + CREATE_AS_USER="--pid host --ipc host --userns=keep-id --user root:root $VOLUMES" for ENV in $USER_ENV ; do eval VAL="$""$ENV" [[ -n "$VAL" ]] && USER_ENV_STR="$USER_ENV_STR --env $ENV=$VAL"