解决Catalina 及以上的macos 的系统没有读写的权限 vault /AppleInternal

Catalina 及以上的macos 的系统手动写入 vault /AppleInternal 的脚本

#!/bin/bash
#
# This will setup a writable /vault on Catalina
set -e

# Get sudo
echo "This script needs sudo permissions. Prompting if needed"
sudo true

# Check that we have a data volume
DATA_VOLUME="/System/Volumes/Data"
if [[ ! -d "$DATA_VOLUME" ]]; then
    echo "Could not find data volume"
    exit 1
fi

# Ensure we have a synthetic.conf file
SYNTHETIC_FILE="/etc/synthetic.conf"
sudo touch "$SYNTHETIC_FILE"

function add_folder()
{
    local folder_name=$1
    local target_folder="$DATA_VOLUME/${folder_name}"

    if [[ -d "/${folder_name}" ]]; then
        echo "/${folder_name} already exist, skip"
        return
    fi

    echo "Create folder(${folder_name}) on data volume if needed"
    if [[ ! -d "$target_folder" ]]; then
        sudo mkdir "$target_folder"
    fi

    # Check synthetic.conf doesn't have a conflicting file
    if [[ "$(cat "$SYNTHETIC_FILE" |grep "^${folder_name}" |wc -l |sed 's/^ *//')" != "0" ]]; then
        echo "$SYNTHETIC_FILE already has a config for ${folder_name} so this script won't override it"
        return
    fi

    # Append the line we care about
    printf "${folder_name}\t$target_folder\n" |sudo tee -a "$SYNTHETIC_FILE" > /dev/null
}

add_folder "vault"
add_folder "AppleInternal"

echo "Fixed $SYNTHETIC_FILE. Reboot machine then try installing Atlas again"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值