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-08-25 20:56:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/toolbox (Old) and /work/SRC/openSUSE:Factory/.toolbox.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "toolbox" Wed Aug 25 20:56:33 2021 rev:15 rq:913783 version:2.2+git20210823.dd0fff8 Changes: -------- --- /work/SRC/openSUSE:Factory/toolbox/toolbox.changes 2021-04-10 15:26:47.554337184 +0200 +++ /work/SRC/openSUSE:Factory/.toolbox.new.1899/toolbox.changes 2021-08-25 20:57:13.765238292 +0200 @@ -1,0 +2,11 @@ +Mon Aug 23 13:37:09 UTC 2021 - [email protected] + +- Update to version 2.2+git20210823.dd0fff8: + * README mini-typo + * Docker: don't use unsupported --userns=keep-id + * Docker: also check for created status + * Try to use docker if installed and podman is not + * Properly share namespaces in non-user toolboxes + * Properly quote workdir + +------------------------------------------------------------------- Old: ---- microos-toolbox-2.1+git20210329.d14ac82.tar.xz New: ---- microos-toolbox-2.2+git20210823.dd0fff8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ toolbox.spec ++++++ --- /var/tmp/diff_new_pack.X23JVj/_old 2021-08-25 20:57:14.273237624 +0200 +++ /var/tmp/diff_new_pack.X23JVj/_new 2021-08-25 20:57:14.277237619 +0200 @@ -17,7 +17,7 @@ Name: toolbox -Version: 2.1+git20210329.d14ac82 +Version: 2.2+git20210823.dd0fff8 Release: 0 Summary: Script to start a toolbox container for system debugging License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.X23JVj/_old 2021-08-25 20:57:14.309237577 +0200 +++ /var/tmp/diff_new_pack.X23JVj/_new 2021-08-25 20:57:14.309237577 +0200 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> - <param name="version">2.1</param> - <param name="versionformat">2.1+git%cd.%h</param> + <param name="version">2.2</param> + <param name="versionformat">2.2+git%cd.%h</param> <param name="url">git://github.com/kubic-project/microos-toolbox.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.X23JVj/_old 2021-08-25 20:57:14.325237556 +0200 +++ /var/tmp/diff_new_pack.X23JVj/_new 2021-08-25 20:57:14.329237551 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/kubic-project/microos-toolbox.git</param> - <param name="changesrevision">02495cfc046e00ca08e8642bf807423257edafc6</param> + <param name="changesrevision">dd0fff8bf7a8462a22d93eedc14ae2bcc84b8b23</param> </service> </servicedata> \ No newline at end of file ++++++ microos-toolbox-2.1+git20210329.d14ac82.tar.xz -> microos-toolbox-2.2+git20210823.dd0fff8.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microos-toolbox-2.1+git20210329.d14ac82/README.md new/microos-toolbox-2.2+git20210823.dd0fff8/README.md --- old/microos-toolbox-2.1+git20210329.d14ac82/README.md 2021-03-29 11:34:23.000000000 +0200 +++ new/microos-toolbox-2.2+git20210823.dd0fff8/README.md 2021-08-23 14:53:05.000000000 +0200 @@ -7,7 +7,7 @@ ## Usage -The following options are avialbe in `toolbox`: +The following options are available in `toolbox`: * `-h` or `--help`: Shows the help message * `-u` or `--user`: Run as the current user inside the container * `-R` or `--reg` `<registry>`: Explicitly specify the registry to use diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/microos-toolbox-2.1+git20210329.d14ac82/toolbox new/microos-toolbox-2.2+git20210823.dd0fff8/toolbox --- old/microos-toolbox-2.1+git20210329.d14ac82/toolbox 2021-03-29 11:34:23.000000000 +0200 +++ new/microos-toolbox-2.2+git20210823.dd0fff8/toolbox 2021-08-23 14:53:05.000000000 +0200 @@ -24,6 +24,11 @@ TOOLBOX_SHELL="/bin/bash" SUDO= +CLI=podman +if [[ ! -f /usr/bin/podman ]] && [[ -f /usr/bin/docker ]]; then + CLI=docker +fi + test -f /usr/etc/toolboxrc && . /usr/etc/toolboxrc test -f /etc/toolboxrc && . /etc/toolboxrc @@ -79,13 +84,13 @@ [[ -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')" + echo "(To remove the container and start with a fresh toolbox, run: $CLI rm '$TOOLBOX_NAME')" msg="start" fi local state state=$(container_state) - if [[ "$state" == configured ]] || [[ "$state" == exited ]] || [[ "$state" == stopped ]]; then + if [[ "$state" == configured ]] || [[ "$state" == exited ]] || [[ "$state" == stopped ]] || [[ "$state" == created ]]; then container_start elif [[ "$state" != running ]]; then echo "Container '$TOOLBOX_NAME' in unknown state: '$state'" @@ -110,8 +115,8 @@ fi mkdir -p /etc/sudoers.d/ && echo "${USER_NAME} ALL = (root) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME} EOF - ${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}" + ${SUDO} $CLI exec --user root "${TOOLBOX_NAME}" bash "${tmp_user_setup}" &> "${tmp_user_setup_log}" + ${SUDO} $CLI exec --user root "${TOOLBOX_NAME}" rm "${tmp_user_setup}" fi echo "Container ${msg}ed." @@ -125,31 +130,31 @@ } cleanup() { - ${SUDO} podman stop "$TOOLBOX_NAME" &>/dev/null + ${SUDO} $CLI stop "$TOOLBOX_NAME" &>/dev/null ${SUDO} rm -f $tmp_user_setup } container_exists() { - ${SUDO} podman inspect "$TOOLBOX_NAME" &>/dev/null + ${SUDO} $CLI inspect "$TOOLBOX_NAME" &>/dev/null } container_state() { - ${SUDO} podman inspect "$TOOLBOX_NAME" --format '{{.State.Status}}' + ${SUDO} $CLI inspect "$TOOLBOX_NAME" --format '{{.State.Status}}' } image_exists() { - ${SUDO} podman inspect "$TOOLBOX_IMAGE" &>/dev/null + ${SUDO} $CLI inspect "$TOOLBOX_IMAGE" &>/dev/null } image_runlabel() { - ${SUDO} podman container runlabel --display RUN "$TOOLBOX_IMAGE" 2> /dev/null + ${SUDO} $CLI container runlabel --display RUN "$TOOLBOX_IMAGE" 2> /dev/null } image_pull() { if [ -z ${SUDO} ] && [ $(id -u) -ne 0 ]; 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 " Toolbox will only work for this user if rootless $CLI 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." @@ -157,19 +162,21 @@ exit 1 fi fi - ${SUDO} podman pull "$TOOLBOX_IMAGE" + ${SUDO} $CLI pull "$TOOLBOX_IMAGE" } list() { - ${SUDO} podman ps --all + ${SUDO} $CLI ps --all exit $? } container_create() { - if ! ${SUDO} podman create \ + if ! ${SUDO} $CLI create \ --hostname "$TOOLBOX_NAME" \ --name "$TOOLBOX_NAME" \ --network host \ + --pid host \ + --ipc host \ --privileged \ --security-opt label=disable ${CREATE_AS_USER} \ --volume /:/media/root:rslave \ @@ -184,25 +191,25 @@ } container_start() { - if ! ${SUDO} podman start "$TOOLBOX_NAME" 2>&1; then + if ! ${SUDO} $CLI start "$TOOLBOX_NAME" 2>&1; then echo "$0: failed to start container '$TOOLBOX_NAME'" exit 1 fi } container_runlabel() { - if ! ${SUDO} podman container runlabel --name "$TOOLBOX_NAME" RUN "$TOOLBOX_IMAGE" 2>&1; then + if ! ${SUDO} $CLI container runlabel --name "$TOOLBOX_NAME" RUN "$TOOLBOX_IMAGE" 2>&1; then echo "$0: failed to runlabel on image '$TOOLBOX_IMAGE'" exit 1 fi } container_exec() { - ${SUDO} podman exec \ + ${SUDO} $CLI exec \ --env LANG="$LANG" \ --env TERM="$TERM" \ --interactive \ - --tty ${EXEC_AS_USER} \ + --tty "${EXEC_AS_USER[@]}" \ "$TOOLBOX_NAME" \ "$@" } @@ -213,7 +220,7 @@ [[-t/--tag <tag>]|[-c/--container <name>]] [command_to_run]] toolbox is a small script that launches a container to let you bring in your favorite debugging or admin tools. The toolbox container is a pet container and will be restarted on following runs. -To remove the container and start fresh, do podman rm ${TOOLBOX_NAME}. +To remove the container and start fresh, do $CLI rm ${TOOLBOX_NAME}. Commands are optional and imply user mode (-u): list: List existing toolboxes @@ -224,7 +231,7 @@ Options: -h/--help: Shows this help message -u/--user: Run as the current user inside the container - -r/--root: Runs podman via sudo as root + -r/--root: Runs $CLI via sudo as root -t/--tag <tag>: Add <tag> to the toolbox name -c/--container <name>: Set the name of the toolbox to be equal to <name> (use this alternatively to -t) @@ -366,12 +373,16 @@ 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 --ipc host --userns=keep-id --user root:root $VOLUMES" + if [[ "$CLI" == "podman" ]]; then + CREATE_AS_USER="--userns=keep-id --user root:root $VOLUMES" + elif [[ "$CLI" == "docker" ]]; then + CREATE_AS_USER="--user root:root $VOLUMES" + fi for ENV in $USER_ENV ; do eval VAL="$""$ENV" - [[ -n "$VAL" ]] && USER_ENV_STR="$USER_ENV_STR --env $ENV=$VAL" + [[ -n "$VAL" ]] && USER_ENV_ARR+=(--env "$ENV=$VAL") done - EXEC_AS_USER="--user ${USER_ID}:${USER_GID} -w $(pwd) $USER_ENV_STR" + EXEC_AS_USER=(--user "${USER_ID}:${USER_GID}" -w "$(pwd)" "${USER_ENV_ARR[@]}") fi if [ -n "$TAG" ]; then
