Menu

Reinstall rEFInd on an imac

2020-05-15
2020-05-15
  • George Wren

    George Wren - 2020-05-15

    Hi. I'd like to try an reinstall rEFInd on an imac, original install no longer loads. Can I just reinstall it or is it better to uninstall the original first? How can I tell if the original install components are even still there?
    Any advice or questions would be appreciated, thanks!

     
  • joevt

    joevt - 2020-05-15

    If it's still installed, then you just need to rebless it with the bless command. If you installed it to an HFS+ partition with ownhfs, then it will be listed in the Startup Disk preferences panel. If not, then it's probably on an EFI partition. EFI partitions are not mounted automatically by the Finder but you can mount them manually. I use the following script to mount all EFI partitions.

    mountpartition() {
        local mounttype=$1
        local slice=$2
        local volume=$3
        local mountpoint=$(mount | sed -n -E "/\/dev\/$slice on (.*) \(.*/s//\1/p")
        if [ -z $mountpoint ]; then
            i=0
            local startmountpoint="/Volumes/$volume"
            mountpoint="$startmountpoint"
            while [ -d "$mountpoint" ]; do
                ((i++))
                mountpoint="$startmountpoint$i"
            done
        fi
        if [ ! -d "$mountpoint" ]; then
            sudo mkdir "$mountpoint" 2> /dev/null
            sudo mount$mounttype "/dev/$slice" "$mountpoint"
        fi
        echo -n "$mountpoint"
    }
    
    getvolumename () {
        local slice="$1"
        eval "$(diskutil info -plist /dev/$slice | plutil -p - | sed -nE '/^ *"VolumeName" => (.*)/s//echo \1/p')"
    }
    
    
    mountEFIpartitions () {
        IFS=$'\n'
        local diskinfo=""
        for diskinfo in $(diskutil list | sed -nE '/^ *[0-9]+: +EFI (.*[^ ]) +[0-9.]+ [^ ]?B +(disk[0-9]+s[0-9]+)$/s//\1_\2/p'); do
            local slice="${diskinfo##*_}"
            local volume="$(getvolumename $slice)"
            mountpartition "_msdos" "$slice" "$volume" > /dev/null
        done
    }
    
    mountEFIpartitions
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.