Skip to content
This repository was archived by the owner on Aug 24, 2024. It is now read-only.

Commit 234ea48

Browse files
committed
fix: incorrect permissions on apt repository .list files when umask is not default(0022)
1 parent 47544fc commit 234ea48

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

after-effects

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,20 @@ function add_repositories()
11661166

11671167
_log_stage "Setting up repositories"
11681168

1169+
AE_UMASK_PRE_HOOK="$(umask)"
1170+
_log_debug "Default UMASK is $AE_UMASK_PRE_HOOK"
1171+
1172+
if [[ $AE_UMASK_PRE_HOOK != "0022" ]]; then
1173+
_log_notice "Setting UMASK to 0022 for the script to avoid APT errors"
1174+
_log_notice "This will be reverted at the end of this task."
1175+
if ! umask 0022; then
1176+
_log_error "Failed to set UMASK to 0022 for task: Repositories"
1177+
_log_error "This may result in errors while updating repositories via packagekit"
1178+
fi
1179+
else
1180+
_log_debug "No need to modify UMASK"
1181+
fi
1182+
11691183

11701184
local exit_status
11711185
local sources_list_bak_ts
@@ -1789,6 +1803,16 @@ deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
17891803
_log_debug "Skipped ROS"
17901804
fi # add_ros_repo
17911805

1806+
# Reset UMASK if not 0022
1807+
if [[ $AE_UMASK_PRE_HOOK != "0022" ]]; then
1808+
_log_notice "Setting UMASK back to $AE_UMASK_PRE_HOOK"
1809+
if ! umask "$AE_UMASK_PRE_HOOK"; then
1810+
_log_error "Failed to set UMASK back to $AE_UMASK_PRE_HOOK"
1811+
fi
1812+
else
1813+
_log_debug "No need to modify UMASK (post-task-hook)"
1814+
fi
1815+
17921816
update_repos
17931817

17941818

0 commit comments

Comments
 (0)