Skip to content

Commit

Permalink
fix: permission of created .config dir in labwc
Browse files Browse the repository at this point in the history
When the $HOMEDIR/.config/labwc folder is created it also creates the
$HOMEDIR/.config folder if it doesn't exist. As raspi-config is run with
sudo this makes the root user own the $HOMEDIR/.config directory.
Afterwards, only the $HOMEDIR/.config/labwc directory owner is changed
to $USER.

Add a function that ensures that the $HOMEDIR/.config directory exists
and, if it doesn't, create it with the correct permissions.

Fixes: RPi-Distro#267
Signed-off-by: Thomas Böhler <[email protected]>
  • Loading branch information
tboehler1 committed Jan 14, 2025
1 parent 8a1fad8 commit a438684
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions raspi-config
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ end
EOF
}

ensure_user_conf_dir() {
if [ ! -d "$HOMEDIR/.config" ]; then
install -d -o "$USER" -g "$USER" "$HOMEDIR/.config"
fi
}

get_overscan() {
OVS=$(get_config_var disable_overscan $CONFIG)
if [ $OVS -eq 1 ]; then
Expand Down Expand Up @@ -569,6 +575,7 @@ do_blanking() {
if [ "$RET" -eq "$CURRENT" ]; then
ASK_TO_REBOOT=1
fi
ensure_user_conf_dir
mkdir -p "$HOMEDIR/.config/labwc/"
chown -R $USER:$USER "$HOMEDIR/.config/labwc/"
if [ "$RET" -eq 0 ] ; then
Expand Down Expand Up @@ -663,6 +670,7 @@ update_labwc_keyboard() {
VARIANT=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"')
OPTIONS=$(grep XKBOPTIONS /etc/default/keyboard | cut -d= -f2 | tr -d '"')
UFILE=$LABWCENV_FILE
ensure_user_conf_dir
mkdir -p "$HOMEDIR/.config/labwc/"
chown -R $USER:$USER "$HOMEDIR/.config/labwc/"
if [ -e $UFILE ] ; then
Expand Down

0 comments on commit a438684

Please sign in to comment.