Skip to content

Commit

Permalink
Release 23.07.1
Browse files Browse the repository at this point in the history
  • Loading branch information
accetto committed Jul 24, 2023
1 parent 317fea4 commit fb97358
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

***

### Release 23.07.1

This release brings some enhancements in the Dockerfiles and the script `user_generator.rc` with the aim to better support extending the images.

### Release 23.07

This release introduces a new feature `FEATURES_OVERRIDING_ENVV`, which controls the overriding or adding of environment variables at the container startup-time.
Expand Down
16 changes: 8 additions & 8 deletions ci-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ main() {

for p in "${pivotal_blends[@]}" ; do

build_family "${command}" "${p}" "-chromium" "-firefox"
build_family "${command}" "${p}" "-firefox" "-chromium"
done
;;

Expand Down Expand Up @@ -346,37 +346,37 @@ main() {
complete-latest )

clear_log
build_group "${command}" "latest" "latest-chromium" "latest-firefox"
build_group "${command}" "latest" "latest-firefox" "latest-chromium"
;;

complete-blender )

clear_log
build_group "${command}" "blender" "blender-chromium" "blender-firefox"
build_group "${command}" "blender" "blender-firefox" "blender-chromium"
;;

complete-drawio )

clear_log
build_group "${command}" "drawio" "drawio-chromium" "drawio-firefox"
build_group "${command}" "drawio" "drawio-firefox" "drawio-chromium"
;;

complete-gimp )

clear_log
build_group "${command}" "gimp" "gimp-chromium" "gimp-firefox"
build_group "${command}" "gimp" "gimp-firefox" "gimp-chromium"
;;

complete-inkscape )

clear_log
build_group "${command}" "inkscape" "inkscape-chromium" "inkscape-firefox"
build_group "${command}" "inkscape" "inkscape-firefox" "inkscape-chromium"
;;

complete-freecad )

clear_log
build_group "${command}" "freecad" "freecad-chromium" "freecad-firefox"
build_group "${command}" "freecad" "freecad-firefox" "freecad-chromium"
;;

complete )
Expand All @@ -385,7 +385,7 @@ main() {

for p in "${pivotal_blends[@]}" ; do

list+=( "${p}" "${p}-chromium" "${p}-firefox" )
list+=( "${p}" "${p}-firefox" "${p}-chromium" )
done
build_group "${command}" "${list[@]}"
;;
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile.xfce
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ COPY ./xfce/src/home/readme*.md "${HOME}"/
### Note that all this will not be done, if the startup script will not be executed.
RUN \
chmod 666 /etc/passwd /etc/group \
&& echo "${HEADLESS_USER_GROUP_NAME}:x:${HEADLESS_USER_GROUP_ID}:" >> /etc/group \
&& echo "${HEADLESS_USER_NAME}:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:Default:${HOME}:/bin/bash" >> /etc/passwd \
&& echo "${HEADLESS_USER_NAME} ALL=(ALL:ALL) ALL" | sudo tee /etc/sudoers.d/"${HEADLESS_USER_NAME}" \
&& echo "${ARG_SUDO_INITIAL_PW:-headless}" > "${STARTUPDIR}"/.initial_sudo_password \
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile.xfce.drawing
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ COPY ./xfce/src/home/readme*.md "${HOME}"/
### Note that all this will not be done, if the startup script will not be executed.
RUN \
chmod 666 /etc/passwd /etc/group \
&& echo "${HEADLESS_USER_GROUP_NAME}:x:${HEADLESS_USER_GROUP_ID}:" >> /etc/group \
&& echo "${HEADLESS_USER_NAME}:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:Default:${HOME}:/bin/bash" >> /etc/passwd \
&& echo "${HEADLESS_USER_NAME} ALL=(ALL:ALL) ALL" | sudo tee /etc/sudoers.d/"${HEADLESS_USER_NAME}" \
&& echo "${ARG_SUDO_INITIAL_PW:-headless}" > "${STARTUPDIR}"/.initial_sudo_password \
Expand Down
76 changes: 45 additions & 31 deletions docker/src/xfce-startup/user_generator.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,76 @@ generate_container_user() {

local user_id
local group_id
local application_user_name
local group_name
local headless_user_name
local headless_group_name

### note that this block will be exuceted only once (see the end of the if-block)
### note that this block will be executed only once (see the end of the if-block)
if [[ -w /etc/passwd ]] ; then

user_id="$(id -u)"
group_id="$(id -g)"
application_user_name="${HEADLESS_USER_NAME}"
group_name="${HEADLESS_USER_GROUP_NAME}"
headless_user_name="${HEADLESS_USER_NAME}"
headless_group_name="${HEADLESS_USER_GROUP_NAME}"

### add the new group if the same GID does not exist yet
if [[ "${group_id}" != "0" && "${group_id}" != "${HEADLESS_USER_GROUP_ID}" ]] ; then

### rename the existing 'headless_group_name' into 'g3builder'
if [[ $( grep -c "${headless_group_name}:x:${HEADLESS_USER_GROUP_ID}:" /etc/group ) -ne 0 ]]; then

cat /etc/group | sed -e "s/^${headless_group_name}:x:${HEADLESS_USER_GROUP_ID}:/g3builder:x:${HEADLESS_USER_GROUP_ID}:/" > /tmp/group

cp /tmp/group /etc/
rm /tmp/group

if [[ -n "${_verbose}" ]] ; then
echo "Default user group '${headless_group_name}(${HEADLESS_USER_GROUP_ID})' renamed into 'g3builder(${HEADLESS_USER_GROUP_ID})' in '/etc/group'"
fi
fi

### add the current default user group ID as a new 'headless_group_name' if it does not exist yet
if [[ $( grep -c -E ":x:${group_id}:$" /etc/group ) -eq 0 ]] ; then

cat /etc/group > /tmp/group
echo "${headless_group_name}:x:${group_id}:" >> /tmp/group

cp /tmp/group /etc/
rm /tmp/group

if [[ -n "${_verbose}" ]] ; then
echo "Default user group '${headless_group_name}(${group_id})' added into '/etc/group'"
fi
fi
fi

### user 'root (0)' is always created by default
### user 'application_user_name' is created by Dockerfile
### user 'headless_user_name' is created by Dockerfile
if [[ "${user_id}" != "0" && "${user_id}" != "${HEADLESS_USER_ID}" ]] ; then

### rename the existing 'application_user_name' to 'builder'
if [[ $( grep -c "${application_user_name}:x:${HEADLESS_USER_ID}:" /etc/passwd ) -ne 0 ]]; then
### rename the existing 'headless_user_name' into 'g3builder'
if [[ $( grep -c "${headless_user_name}:x:${HEADLESS_USER_ID}:" /etc/passwd ) -ne 0 ]]; then

cat /etc/passwd | sed -e "s/^${application_user_name}:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:Default:/builder:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:Builder:/" > /tmp/passwd
cat /etc/passwd | sed -e "s/^${headless_user_name}:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:Default:/g3builder:x:${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID}:G3Builder:/" > /tmp/passwd

cp /tmp/passwd /etc/
rm /tmp/passwd

if [[ -n "${_verbose}" ]] ; then
echo "User '${application_user_name} (${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID})' renamed to 'builder (${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID})' in '/etc/passwd'"
echo "Default user '${headless_user_name}(${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID})' renamed into 'g3builder(${HEADLESS_USER_ID}:${HEADLESS_USER_GROUP_ID})' in '/etc/passwd'"
fi
fi

### add the current application user ID as a new 'application_user_name' if it does not exist yet
if [[ $( grep -c "${application_user_name}:x:${user_id}:" /etc/passwd ) -eq 0 ]] ; then
### add the current default user ID as a new 'headless_user_name' if it does not exist yet
if [[ $( grep -c "${headless_user_name}:x:${user_id}:" /etc/passwd ) -eq 0 ]] ; then

cat /etc/passwd > /tmp/passwd
echo "${application_user_name}:x:${user_id}:${group_id}:Default:${HOME}:/bin/bash" >> /tmp/passwd
echo "${headless_user_name}:x:${user_id}:${group_id}:Default:${HOME}:/bin/bash" >> /tmp/passwd

cp /tmp/passwd /etc/
rm /tmp/passwd

if [[ -n "${_verbose}" ]] ; then
echo "User '${application_user_name} (${user_id}:${group_id})' added into '/etc/passwd'"
echo "Default user '${headless_user_name}(${user_id}:${group_id})' added into '/etc/passwd'"
fi

### update the environment variables
Expand All @@ -52,23 +83,6 @@ generate_container_user() {
fi
fi

### add the new group if the same GID does not exist yet
if [[ "${group_id}" != "0" ]] ; then

if [[ $( grep -c -E ":x:${group_id}:$" /etc/group ) -eq 0 ]] ; then

cat /etc/group > /tmp/group
echo "${group_name}:x:${group_id}:" >> /tmp/group

cp /tmp/group /etc/
rm /tmp/group

if [[ -n "${_verbose}" ]] ; then
echo "Group '${group_name} (${group_id})' added into '/etc/group'"
fi
fi
fi

if [[ -s "${STARTUPDIR}"/.initial_sudo_password ]] ; then

### make the newly created user the owner of the following folders including their content
Expand Down

0 comments on commit fb97358

Please sign in to comment.