Skip to content

Commit

Permalink
chore: make --force the default when hdiutil detach-ing 🇬🇧
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Sep 3, 2024
1 parent fc1e2c5 commit a1e10bf
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/server/routes/ipsw/ipsw.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func getFsFiles(pemDB string) gin.HandlerFunc {
defer func() {
utils.Indent(log.Info, 2)(fmt.Sprintf("Unmounting %s", dmgPath))
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(mountPoint, false)
return utils.Unmount(mountPoint, true)
}); err != nil {
log.Errorf("failed to unmount %s at %s: %v", dmgPath, mountPoint, err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipsw/cmd/ia.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var iaCmd = &cobra.Command{
defer func() {
log.Debugf("Unmounting %s", dmgPath)
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(mountPoint, false)
return utils.Unmount(mountPoint, true)
}); err != nil {
utils.Indent(log.Error, 3)(fmt.Sprintf("failed to unmount %s at %s: %v", dmgPath, mountPoint, err))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipsw/cmd/mdevs.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var mdevsCmd = &cobra.Command{
defer func() {
log.Debugf("Unmounting %s", dmgPath)
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(mountPoint, false)
return utils.Unmount(mountPoint, true)
}); err != nil {
log.Errorf("failed to unmount %s at %s: %v", dmgPath, mountPoint, err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/mount/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (c Context) Unmount() error {
}
}
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(c.MountPoint, false)
return utils.Unmount(c.MountPoint, true)
}); err != nil {
return fmt.Errorf("failed to unmount %s at %s: %v", c.DmgPath, c.MountPoint, err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ func (d *Diff) mountSystemOsDMGs() (err error) {
func (d *Diff) unmountSystemOsDMGs() error {
utils.Indent(log.Info, 2)("Unmounting 'Old' SystemOS DMG")
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(d.Old.MountPath, false)
return utils.Unmount(d.Old.MountPath, true)
}); err != nil {
utils.Indent(log.Error, 3)(fmt.Sprintf("failed to unmount 'Old' SystemOS DMG: %v", err))
}
utils.Indent(log.Info, 2)("Unmounting 'New' SystemOS DMG")
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(d.New.MountPath, false)
return utils.Unmount(d.New.MountPath, true)
}); err != nil {
utils.Indent(log.Error, 3)(fmt.Sprintf("failed to unmount 'New' SystemOS DMG: %v", err))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/download/macos.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func (i *ProductInfo) DownloadInstaller(workDir, proxy string, insecure, skipAll
}

if _, err := os.Stat(sparseDiskimageMount); os.IsExist(err) {
if err := utils.Unmount(sparseDiskimageMount, false); err != nil {
if err := utils.Unmount(sparseDiskimageMount, true); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func scanDmg(ipswPath, dmgPath, dmgType, pemDB string, handler func(string, stri
defer func() {
utils.Indent(log.Debug, 2)(fmt.Sprintf("Unmounting %s", dmgPath))
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(mountPoint, false)
return utils.Unmount(mountPoint, true)
}); err != nil {
log.Errorf("failed to unmount %s at %s: %v", dmgPath, mountPoint, err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ota/aa.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func (r *Reader) ExtractFromCryptexes(pattern, output string) ([]string, error)
defer func() {
utils.Indent(log.Debug, 4)(fmt.Sprintf("Unmounting %s", dcf.Name()))
if err := utils.Retry(3, 2*time.Second, func() error {
return utils.Unmount(mountPoint, false)
return utils.Unmount(mountPoint, true)
}); err != nil {
log.Errorf("failed to unmount DMG %s at %s: %v", dcf.Name(), mountPoint, err)
}
Expand Down

0 comments on commit a1e10bf

Please sign in to comment.