diff --git a/ChangeLog b/ChangeLog index 1b5cb4a..5fcac14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +due (2.1.0-1) unstable; urgency=medium + + * debian-package: duebuild now builds binaries by default, not source as well. + * debian-package: fixed incorrect examples in help-examples. + * debian-package: --use-local-repo now usues due-manage-local-repo.sh. + * debian-package: added due-manage-local-repo.sh to let the user add/remove local pacakges.o + * debian-package: README.md - updated with due-manage-local-repo.sh documentation. + * debian-package: duebuild - better error handling on dependency install fails. + * common-templates: c-add-docker-user script will add user to docker group, if it exists + * onie: Initial support for a Debian 10 build environment + + -- Alex Doyle Fri, 27 Nov 2020 17:00:00 -0700 + due (2.0.0-1) unstable; urgency=medium * Initial upload. Closes: #931617 diff --git a/docs/due.1 b/docs/due.1 index 969f0ac..759d14b 100644 --- a/docs/due.1 +++ b/docs/due.1 @@ -1,35 +1,38 @@ -.\" Automatically generated by Pandoc 1.19.2.4 +.\" Automatically generated by Pandoc 2.9.2.1 .\" -.TH "DUE" "1" "" "Version 2.0.0" "Dedicated User Environment" +.TH "DUE" "1" "" "Version 2.1.0" "Dedicated User Environment" .hy .SH NAME .PP -\f[B]due\f[] \- Dedicated User Environment. +\f[B]due\f[R] - Dedicated User Environment. A build environment for your build environments. .SH SYNOPSIS .PP -\f[B]due\f[] [\f[B]\-r|\-\-run\f[] \f[I]args\f[]] [\f[I]dedication\f[]] +\f[B]due\f[R] [\f[B]-r|\[en]run\f[R] \f[I]args\f[R]] +[\f[I]dedication\f[R]] .PD 0 .P .PD -\f[B]due\f[] [ \f[B]\-\-create\f[] \f[I]args\f[] ] [\f[I]dedication\f[]] +\f[B]due\f[R] [ \f[B]\[en]create\f[R] \f[I]args\f[R] ] +[\f[I]dedication\f[R]] .PD 0 .P .PD -\f[B]due\f[] [ \f[B]\-\-delete\f[] \f[I]term\f[] ] [\f[I]dedication\f[]] +\f[B]due\f[R] [ \f[B]\[en]delete\f[R] \f[I]term\f[R] ] +[\f[I]dedication\f[R]] .PD 0 .P .PD -\f[B]due\f[] [\f[B]\-m\f[]|\f[B]\-\-manage\f[] \f[I]args\f[]] -[\f[I]dedication\f[]] +\f[B]due\f[R] [\f[B]-m\f[R]|\f[B]\[en]manage\f[R] \f[I]args\f[R]] +[\f[I]dedication\f[R]] .PD 0 .P .PD -\f[B]due\f[] [\f[B]\-v\f[]|\f[B]\-\-version\f[]] +\f[B]due\f[R] [\f[B]-v\f[R]|\f[B]\[en]version\f[R]] .PD 0 .P .PD -\f[B]due\f[] [\f[B]\-h\f[]|\f[B]\-\-help\f[]] +\f[B]due\f[R] [\f[B]-h\f[R]|\f[B]\[en]help\f[R]] .SH DESCRIPTION .PP DUE is a set of wrapper scripts for both creating Docker container based @@ -38,88 +41,70 @@ the user can feel like they are still on the host system. .PP Key features include: .PP -1 \- Creating an account in the container for the user at run time and -mounting the user\[aq]s home/work directory so configuration files are +1 - Creating an account in the container for the user at run time and +mounting the user\[cq]s home/work directory so configuration files are available. .PP -2 \- List based browsing of images to run and active containers to log -in to. +2 - List based browsing of images to run and active containers to log in +to. .PP -3 \- Use of container \[aq]templates\[aq] to pre configure and build -containers for a particular target or Debian based operating system, -eliminating errors caused by missing dependencies, or misconfiguration. +3 - Use of container `templates' to pre configure and build containers +for a particular target or Debian based operating system, eliminating +errors caused by missing dependencies, or misconfiguration. .PP -4 \- Commands can be run using the container without having to log into +4 - Commands can be run using the container without having to log into it, allowing for use in automated build environments. .SS Functional Options .PP Each of these options has context specific help and sub commands .TP -.B \-r, \-\-run +-r, \[en]run Start new containers. -.RS -.RE .TP -.B \-\-build, \-\-duebuild -Execute container\[aq]s /usr/local/bin/duebuild script in current +\[en]build, \[en]duebuild +Execute container\[cq]s /usr/local/bin/duebuild script in current directory. -See the \-\-run section for more. -.RS -.RE +See the \[en]run section for more. .TP -.B \-\-create +\[en]create Make and configure new Docker images. -.RS -.RE .TP -.B \-\-delete +\[en]delete Delete existing Docker images that match the term. -.RS -.RE .TP -.B \-m, \-\-manage +-m, \[en]manage Manipulate and query existing images. -.RS -.RE .TP -.B \-h, \-\-help +-h, \[en]help Usage information. -.RS -.RE .TP -.B \-v, \-\-version -Print DUE\[aq]s version number. -.RS -.RE -.SS \-\-run options +-v, \[en]version +Print DUE\[cq]s version number. +.SS \[en]run options .PP -These options are available after the \-\-run argument, and relate to +These options are available after the \[en]run argument, and relate to starting and logging in to containers. .SS Starting an image .TP -.B \-i, \-\-run\-image [filter] +-i, \[en]run-image [filter] Allows the user to reduce the number of images shown to run by restricting them to entries that contain [filter]. If only one image matches the filter, it will be invoked without asking the user to choose it. -.RS -.RE .TP -.B \-a, \-\-all +-a, \[en]all Show all containers on the system. DUE can be used to log in to containers that it did not create, but the -user may have to supply a default \-\-username and \-\-userid (usually -\-\-username root and \-\-userid 0. +user may have to supply a default \[en]username and \[en]userid (usually +\[en]username root and \[en]userid 0. See below ) -.RS -.RE .TP -.B \-\-ignore\-type +\[en]ignore-type .IP .nf \f[C] -\ When\ accessing\ the\ container,\ do\ not\ attempt\ to\ create\ a\ user -\f[] + When accessing the container, do not attempt to create a user +\f[R] .fi .RS account for the user logging in, and assume the container was not @@ -127,14 +112,15 @@ created by DUE. This can be useful with image creation debug. .RE .TP -.B \-c, \-\-command [cmd] -Run [cmd] in the container using the \-\-login\-shell. +-c, \[en]command [cmd] +Run [cmd] in the container using the \[en]login-shell. This must be the last command parsed, as [cmd] is handed off to be run in the container. The primary use of this would be using the container to build without having to interactively log in to it. -Note: when issuing multiple commands, remember to "" your arguments, and -backslash () any semicolons (;) used to split up the commands. +Note: when issuing multiple commands, remember to \[dq]\[dq] your +arguments, and backslash () any semicolons (;) used to split up the +commands. Otherwise the shell where the commands are invoked will take anything after the first ;, and treat it as a command to be run locally. This can obfuscate things if the command can work inside or out of the @@ -143,307 +129,228 @@ container. .P .PD Example: look at /proc and the password file in a container: ./due -\-\-run \-\-command "ls \-lrt /proc" ; "cat /etc/passwd" -.RS -.RE +\[en]run \[en]command \[lq]ls -lrt /proc\[rq] ; \[lq]cat +/etc/passwd\[rq] .TP -.B \-\-build | \-\-duebuild +\[en]build | \[en]duebuild If there is a /usr/local/bin/duebuild script in the container, this option will run it with a default configuration, or take additional passed arguments if present. Those arguments will vary depending on the nature of the target being -built by the container\[aq]s duebuild script. +built by the container\[cq]s duebuild script. For more information, check the template/README.md for the image type, -or use: due \-\-duebuild \-\-help to select a container and get its -duebuild script\[aq]s help options directly. -.RS -.RE -.TP -.B \-\-duebuild -Same behavior as \-\-build, but a bit clearer that it is working with -the selected container\[aq]s duebuild script. -One notable difference is that due \-\-duebuild \-\-help will select a -container and execute duebuild \-\-help to see the options provided by +or use: due \[en]duebuild \[en]help to select a container and get its +duebuild script\[cq]s help options directly. +.TP +\[en]duebuild +Same behavior as \[en]build, but a bit clearer that it is working with +the selected container\[cq]s duebuild script. +One notable difference is that due \[en]duebuild \[en]help will select a +container and execute duebuild \[en]help to see the options provided by that particular script. -.RS -.RE .TP -.B \-\-dockerarg [arg] +\[en]dockerarg [arg] Put [arg] in the docker run invocation. -For multiple arguments, use multiple invocations of \-\-dockerarg. -This allows for things like running containers with \-\-privileged -.RS -.RE +For multiple arguments, use multiple invocations of \[en]dockerarg. +This allows for things like running containers with \[en]privileged .TP -.B \-\-debug -Sets defaults of \-\-username root \-\-userid 0 and the \-\-any option -to show images that were not created by DUE. +\[en]debug +Sets defaults of \[en]username root \[en]userid 0 and the \[en]any +option to show images that were not created by DUE. Helpful for internal debug if image creation dies running internal configuration scripts. -.RS -.RE .TP -.B \-\-container\-name name (#name) +\[en]container-name name Change the name of the running container. This can provide clarity in a build automation environment, where containers may be automatically spun up. -Note that if the new name does not have \[aq]due\[aq] in it, it will be -filtered out from DUE\[aq]s \-\-login option unless \-\-all is also -provided. +Note that if the new name does not have `due' in it, it will be filtered +out from DUE\[cq]s \[en]login option unless \[en]all is also provided. This may or may not be desirable behavior. -.RS -.RE .TP -.B \-\-home\-dir [host path] +\[en]home-dir [host path] Absolute path to a directory to use as the home directory when the user logs in. -Defaults to the user\[aq]s home directory unless overridden with this +Defaults to the user\[cq]s home directory unless overridden with this argument, or set otherwise in /etc/due/due.conf, or -~/config/due/due.conf -.RS -.RE +\[ti]/config/due/due.conf .TP -.B \-\-mount\-dir [hp:cp] +\[en]mount-dir [hp:cp] Mount absolute path on host system (hp) at absolute path in container. The colon (:) is necessary to separate the two. -Multiple \-\-mount\-dir commands can be used in a single invocation. -Example: mount host /tmp dir in container /var/build: \-\-mount\-dir +Multiple \[en]mount-dir commands can be used in a single invocation. +Example: mount host /tmp dir in container /var/build: \[en]mount-dir /tmp/:var/build -.RS -.RE .SS Logging in to a running container .TP -.B \-l, \-\-login +-l, \[en]login Choose an existing container to log in to. -.RS -.RE .TP -.B \-\-username [username] +\[en]username [username] Name to use when logging in. -.RS -.RE .TP -.B \-\-userid [id#] +\[en]userid [id#] User ID to use when logging in. -.RS -.RE .TP -.B \-\-groupname [groupname] -Container user\[aq]s default group -.RS -.RE +\[en]groupname [groupname] +Container user\[cq]s default group .TP -.B \-\-groupid [id#] -ID of container user\[aq]s group -.RS -.RE +\[en]groupid [id#] +ID of container user\[cq]s group .TP -.B \-\-login\-shell [path] +\[en]login-shell [path] Program to use as login -.RS -.RE .TP -.B \-\-help\-runtime +\[en]help-runtime Invoke runtime help -.RS -.RE .TP -.B \-\-help\-runtime\-examples +\[en]help-runtime-examples Show examples of use -.RS -.RE -.SS \-\-create options +.SS \[en]create options .PP -These options are accessed after the \-\-create argument, and, +These options are accessed after the \[en]create argument, and, predictably enough, relate to creating new images. .SS Creation Overview .PP Containers created by DUE will always have files from -\&./templates/common\-templates in every image. -The primary example of this is the \f[B]container\-create\-user.sh\f[] +\&./templates/common-templates in every image. +The primary example of this is the \f[B]container-create-user.sh\f[R] script that sets up an account for the user in the container, and allows commands to be run in the container as if it was the user invoking them. .PP -The order of creation is as follows, using the debian\-package template +The order of creation is as follows, using the debian-package template as an example, where the resulting image will be named -\[aq]debian\-package\-10\[aq] +`debian-package-10' .PP -1 \- The contents of common\-templates are copied to a -debian\-package\-10\-template\-merge directory under -\&./due\-build\-merge/ +1 - The contents of common-templates are copied to a +debian-package-10-template-merge directory under ./due-build-merge/ .PD 0 .P .PD -2 \- The contents of the debian\-package template directory copied in to -the debian\-package\-10\-template\-merge directory and will overwrite -any files with identical names. +2 - The contents of the debian-package template directory copied in to +the debian-package-10-template-merge directory and will overwrite any +files with identical names. .PD 0 .P .PD -3 \- Any REPLACE_ fields in the template files are replaced with values +3 - Any REPLACE_ fields in the template files are replaced with values supplied from the command line (such as the starting container image) -and all files are copied to ./due\-build\-merge/debian\-package\-10 +and all files are copied to ./due-build-merge/debian-package-10 .PD 0 .P .PD -4 \- The ./due\-build\-merge/debian\-package\-10/Dockerfile.create file -is used to create the image from this build directory. +4 - The ./due-build-merge/debian-package-10/Dockerfile.create file is +used to create the image from this build directory. .SS Creation tips .PP Quick image changes can be made by editing the build directory ( -\&./due\-build\-merge/debian\-package\-10 ) and re running ./due -\-\-create \-\-build\-dir ./due\-build\-merge/debian\-package\-10 +\&./due-build-merge/debian-package-10 ) and re running ./due \[en]create +\[en]build-dir ./due-build-merge/debian-package-10 .PP -The final image will hold a /due\-configuration directory, which holds +The final image will hold a /due-configuration directory, which holds everything that went into the image. This is very useful for install script debug inside the container. .SS Creation example .PP -1 \- Configure an image build directory under due\-build\-merge named -from \-\-name Mandatory: +1 - Configure an image build directory under due-build-merge named from +\[en]name Mandatory: .TP -.B \-\-from [name:tag] +\[en]from [name:tag] Pull name:tag from registry to use as starting point for the image. -.RS -.RE .TP -.B \-\-use\-template [role] +\[en]use-template [role] Use files from templates/[role] to generate the config directory. -.RS -.RE .TP -.B \-\-description "desc" +\[en]description \[lq]desc\[rq] Quoted string to describe the container on login. -.RS -.RE .TP -.B \-\-name name (#name) +\[en]name name Name for resulting image and config directory. -Ex: debian\-stretch\-build, ubuntu\-18.04\-build, etc -.RS -.RE +Ex: debian-stretch-build, ubuntu-18.04-build, etc .PP Optional: .TP -.B \-\-prompt [prompt] +\[en]prompt [prompt] Set in container prompt to [prompt] to provide user context -.RS -.RE .TP -.B \-\-no\-image -With \-\-create, allow directories to be created, but do not try to +\[en]no-image +With \[en]create, allow directories to be created, but do not try to build the image. -Effectively stops use of \-\-dir. +Effectively stops use of \[en]dir. Useful for debugging directory configuration issues. -.RS -.RE .TP -.B \-\-filter [term] -With \-\-create \-\-help, filter examples to contain [term]. -.RS -.RE +\[en]filter [term] +With \[en]create \[en]help, filter examples to contain [term]. .PP -2 \- Build a Docker image from the image build directory. +2 - Build a Docker image from the image build directory. .TP -.B \-\-dir [dirname] +\[en]dir [dirname] Build using an existing configuration directory. -.RS -.RE .TP -.B \-\-clean -Delete the due\-build\-merge staging directories. -.RS -.RE -.SS \-\-manage options +\[en]clean +Delete the due-build-merge staging directories. +.SS \[en]manage options .PP -These options are accessed after the \-\-manage argument, and can make +These options are accessed after the \[en]manage argument, and can make working with containers/images easier. .TP -.B \-l, \-\-list\-images +-l, \[en]list-images List images created by DUE. -.RS -.RE .TP -.B \-\-stop +\[en]stop Use the menu interface to stop a running container. -Works with \-\-all to show containers not started by the user. -If is supplied, it will match all the user\[aq]s containers to that +Works with \[en]all to show containers not started by the user. +If is supplied, it will match all the user\[cq]s containers to that pattern and produce a script that can be edited and run to delete the listed containers. -NOTE: \-\-all \-\-stop can be used to do some serious damage. -NOTE: since all DUE containers are started with \-rm, stopping a +NOTE: \[en]all \[en]stop can be used to do some serious damage. +NOTE: since all DUE containers are started with -rm, stopping a container deletes it and all the data in it from memory. -.RS -.RE .TP -.B \-\-export\-container name (#name) +\[en]export-container name Export a running container to disk as a Docker image named name. Note that to run the saved image it must be added back to the system -with \-\-import. -.RS -.RE +with \[en]import. .TP -.B \-\-export\-image name (#name) +\[en]export-image name Save an existing Docker image as a file that can be copied elsewhere. If name is not supplied, the user can choose from a menu. -.RS -.RE .TP -.B \-\-import\-image name (#name) +\[en]import-image name Import a docker image stored on disk as tar file -.RS -.RE .TP -.B \-\-copy\-config -Create a personal DUE configuration file in ~/.config/due/due.config -.RS -.RE +\[en]copy-config +Create a personal DUE configuration file in \[ti]/.config/due/due.config .TP -.B \-\-make\-dev\-dir [dir] +\[en]make-dev-dir [dir] Populate a local directory for DUE container development. -.RS -.RE .TP -.B \-\-list\-templates +\[en]list-templates List available templates. -.RS -.RE .TP -.B \-\-delete\-matched [term] +\[en]delete-matched [term] Delete containers that contain this term. USE WITH CAUTION! -.RS -.RE .TP -.B \-\-docker\-clean -Run \[aq]docker system prune ; docker image prune\[aq] to reclaim disk -space. -.RS -.RE +\[en]docker-clean +Run `docker system prune ; docker image prune' to reclaim disk space. .TP -.B \-\-help\-examples +\[en]help-examples Examples of using management options. -.RS -.RE .SH FILES .TP -.B \f[I]/etc/due/due.conf\f[] +\f[I]/etc/due/due.conf\f[R] Global configuration file -.RS -.RE .TP -.B \f[I]~/.conf/due/due.conf\f[] -Per\-user default configuration file. +\f[I]\[ti]/.conf/due/due.conf\f[R] +Per-user default configuration file. Overrides the global one. -\f[C]due\ \-\-manage\ \-\-copy\-config\f[] will set that up for the -user. -.RS -.RE +\f[C]due --manage --copy-config\f[R] will set that up for the user. .SH ENVIRONMENT .PP The configuration file sets up the following variables: .PP -\f[C]DUE_ENV_DEFAULT_HOMEDIR\f[] \- evaled to define the user\[aq]s home +\f[C]DUE_ENV_DEFAULT_HOMEDIR\f[R] - evaled to define the user\[cq]s home directory. This can be useful if there is a naming convention for work directories on shared systems, or your home directory is an NFS mount (which can @@ -454,7 +361,7 @@ create strange behavior when mounted in Docker) or you need to use a bigger build directory. .PP -\f[C]DUE_USER_CONTAINER_LIMIT\f[] \- limit the number of containers a +\f[C]DUE_USER_CONTAINER_LIMIT\f[R] - limit the number of containers a user is allowed to run. Handy on a shared system to remind people of what they have running. This can easily be circumvented, though. @@ -466,23 +373,23 @@ See GitHub Issues: [https://github.com/[CumulusNetworks]/[DUE]/issues] Alex Doyle .SH COPYRIGHT .PP -SPDX\-License\-Identifier: MIT +SPDX-License-Identifier: MIT .PP Copyright (c) 2019,2020 Cumulus Networks, Inc. .PP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to +\[lq]Software\[rq]), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and +to permit persons to whom the Software is furnished to do so, subject to the following conditions: .PP The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. .PP -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +THE SOFTWARE IS PROVIDED \[lq]AS IS\[rq], WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, @@ -490,4 +397,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SH SEE ALSO .PP -\f[B]due.conf(4)\f[] +\f[B]due.conf(4)\f[R] diff --git a/docs/manpage-due-1.md b/docs/manpage-due-1.md index e7127b8..d6fd103 100644 --- a/docs/manpage-due-1.md +++ b/docs/manpage-due-1.md @@ -1,4 +1,4 @@ -% DUE(1) Version 2.0.0 | Dedicated User Environment +% DUE(1) Version 2.1.0 | Dedicated User Environment # NAME diff --git a/libdue b/libdue index 4df400d..fb4e847 100644 --- a/libdue +++ b/libdue @@ -13,7 +13,7 @@ shopt -s extglob # Documentation and changelog builds get the official version from here. -DUE_VERSION="2.0.0" +DUE_VERSION="2.1.0" # Debian packages required for DUE to run REQUIRED_PACKAGES=" docker.io rsync bsdutils git"