From 4f4b9ab51c537198987335846c764ced09da48bc Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 30 Oct 2024 13:13:59 -0700 Subject: [PATCH 1/4] Create desktop.sh --- desktop.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 desktop.sh diff --git a/desktop.sh b/desktop.sh new file mode 100644 index 0000000..a2684b1 --- /dev/null +++ b/desktop.sh @@ -0,0 +1,19 @@ +# set the Desktop dir to something in base +echo 'XDG_DESKTOP_DIR="/usr/share/Desktop"' > /etc/xdg/user-dirs.defaults + +# Copy in the Desktop files +APPLICATIONS_DIR=/usr/share/applications +DESKTOP_DIR=/usr/share/Desktop + +mkdir -p "${DESKTOP_DIR}" +# set the Desktop dir to something in base +echo 'XDG_DESKTOP_DIR="${DESKTOP_DIR}"' > /etc/xdg/user-dirs.defaults +for desktop_file_path in ${REPO_DIR}/Desktop/*.desktop; do + cp "${desktop_file_path}" "${APPLICATIONS_DIR}/." + + # Symlink application to desktop and set execute permission so xfce (desktop) doesn't complain + desktop_file_name="$(basename ${desktop_file_path})" + # Set execute permissions on the copied .desktop file + chmod +x "${APPLICATIONS_DIR}/${desktop_file_name}" + ln -sf "${APPLICATIONS_DIR}/${desktop_file_name}" "${DESKTOP_DIR}/${desktop_file_name}" +done From e364a7a507f91da83607cd874567f46577df99e2 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 30 Oct 2024 13:20:41 -0700 Subject: [PATCH 2/4] Update desktop.sh --- desktop.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/desktop.sh b/desktop.sh index a2684b1..2b99be9 100644 --- a/desktop.sh +++ b/desktop.sh @@ -4,10 +4,13 @@ echo 'XDG_DESKTOP_DIR="/usr/share/Desktop"' > /etc/xdg/user-dirs.defaults # Copy in the Desktop files APPLICATIONS_DIR=/usr/share/applications DESKTOP_DIR=/usr/share/Desktop - mkdir -p "${DESKTOP_DIR}" -# set the Desktop dir to something in base +# set the Desktop dir default for XDG echo 'XDG_DESKTOP_DIR="${DESKTOP_DIR}"' > /etc/xdg/user-dirs.defaults + +# The for loops will fail if they return null (no files). Set shell option nullglob +shopt -s nullglob + for desktop_file_path in ${REPO_DIR}/Desktop/*.desktop; do cp "${desktop_file_path}" "${APPLICATIONS_DIR}/." @@ -17,3 +20,14 @@ for desktop_file_path in ${REPO_DIR}/Desktop/*.desktop; do chmod +x "${APPLICATIONS_DIR}/${desktop_file_name}" ln -sf "${APPLICATIONS_DIR}/${desktop_file_name}" "${DESKTOP_DIR}/${desktop_file_name}" done +update-desktop-database "${APPLICATIONS_DIR}" + +# Add MIME Type data from XML files to the MIME database. +MIME_DIR="/usr/share/mime" +MIME_PACKAGES_DIR="${MIME_DIR}/packages" +mkdir -p "${MIME_PACKAGES_DIR}" +for mime_file_path in ${REPO_DIR}/Desktop/*.xml; do + cp "${mime_file_path}" "${MIME_PACKAGES_DIR}/." +done +update-mime-database "${MIME_DIR}" + From 57d9c6a208ac6b10e78fd9a4dc8f510c4c630ac3 Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 30 Oct 2024 13:30:14 -0700 Subject: [PATCH 3/4] Update appendix --- appendix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appendix b/appendix index 2db1013..26ab571 100644 --- a/appendix +++ b/appendix @@ -61,8 +61,10 @@ ONBUILD RUN echo "Checking for 'Desktop directory'..." \ ; cd "${REPO_DIR}/childimage/" \ ; if test -d Desktop ; then \ mkdir -p "${REPO_DIR}/Desktop" && \ - [ "$(ls -A Desktop 2>/dev/null)" ] && cp -r Desktop/* "${REPO_DIR}/Desktop/"; \ - fi + cp -r Desktop/* "${REPO_DIR}/Desktop/" 2>/dev/null && \ + chmod +x "${REPO_DIR}/desktop.sh" ; \ + fi \ + ; "${REPO_DIR}/desktop.sh" # Install apt packages specified in a apt.txt file if it exists. # blank lines and comments are supported in apt.txt From f2ae636c2186dd5d0f703143c5d65daea27c44da Mon Sep 17 00:00:00 2001 From: Eli Holmes - NOAA Date: Wed, 30 Oct 2024 13:30:36 -0700 Subject: [PATCH 4/4] Update desktop.sh --- desktop.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/desktop.sh b/desktop.sh index 2b99be9..5c277bb 100644 --- a/desktop.sh +++ b/desktop.sh @@ -1,3 +1,6 @@ +#!/bin/bash +set -e + # set the Desktop dir to something in base echo 'XDG_DESKTOP_DIR="/usr/share/Desktop"' > /etc/xdg/user-dirs.defaults