mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 15:04:42 +00:00
Fix support for BSD and GNU mktemp
This commit is contained in:
@@ -288,9 +288,12 @@ register_temp_dir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Create temp file with prefix (for analyze.sh compatibility)
|
# Create temp file with prefix (for analyze.sh compatibility)
|
||||||
|
# Compatible with both BSD mktemp (macOS default) and GNU mktemp (coreutils)
|
||||||
mktemp_file() {
|
mktemp_file() {
|
||||||
local prefix="${1:-mole}"
|
local prefix="${1:-mole}"
|
||||||
mktemp -t "$prefix"
|
# Use TMPDIR if set, otherwise /tmp
|
||||||
|
# Add .XXXXXX suffix to work with both BSD and GNU mktemp
|
||||||
|
mktemp "${TMPDIR:-/tmp}/${prefix}.XXXXXX"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cleanup all tracked temp files and directories
|
# Cleanup all tracked temp files and directories
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ perform_updates() {
|
|||||||
_perform_appstore_update() {
|
_perform_appstore_update() {
|
||||||
echo -e "${BLUE}Updating App Store apps...${NC}"
|
echo -e "${BLUE}Updating App Store apps...${NC}"
|
||||||
local appstore_log
|
local appstore_log
|
||||||
appstore_log=$(mktemp -t mole-appstore 2> /dev/null || echo "/tmp/mole-appstore.log")
|
appstore_log=$(mktemp "${TMPDIR:-/tmp}/mole-appstore.XXXXXX" 2> /dev/null || echo "/tmp/mole-appstore.log")
|
||||||
|
|
||||||
if [[ "$appstore_needs_fallback" == "true" ]]; then
|
if [[ "$appstore_needs_fallback" == "true" ]]; then
|
||||||
echo -e " ${GRAY}Installing all available updates${NC}"
|
echo -e " ${GRAY}Installing all available updates${NC}"
|
||||||
@@ -311,7 +311,7 @@ _perform_macos_update() {
|
|||||||
echo -e "${YELLOW}Note:${NC} System update may require restart"
|
echo -e "${YELLOW}Note:${NC} System update may require restart"
|
||||||
|
|
||||||
local macos_log
|
local macos_log
|
||||||
macos_log=$(mktemp -t mole-macos 2> /dev/null || echo "/tmp/mole-macos.log")
|
macos_log=$(mktemp "${TMPDIR:-/tmp}/mole-macos.XXXXXX" 2> /dev/null || echo "/tmp/mole-macos.log")
|
||||||
|
|
||||||
if [[ "$macos_needs_fallback" == "true" ]]; then
|
if [[ "$macos_needs_fallback" == "true" ]]; then
|
||||||
if sudo softwareupdate -i -r 2>&1 | tee "$macos_log" | grep -v "^$"; then
|
if sudo softwareupdate -i -r 2>&1 | tee "$macos_log" | grep -v "^$"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user