0

我正在通过 Cydia 制作一个可安装的包,它将 com.intelliborn.intelliscreenx 写入:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Hidden</key>
    <array>
        <string>libactivator</string>
        <string>com.aaronash.BarrelSettings</string>
        <string>com.iptm.bigboss.sbsettings</string>
    </array>
</dict>
</plist>

但我不知道如何将 postinst 脚本写入正确添加的位置,并将 postrmv 脚本写入正确删除的位置。

安装此包后 hidden.plist 应如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Hidden</key>
    <array>
        <string>libactivator</string>
        <string>com.aaronash.BarrelSettings</string>
        <string>com.iptm.bigboss.sbsettings</string>
            <string>com.intelliborn.intelliscreenx</string>
    </array>
</dict>

这是我的 postinst 和 postrmv 脚本的外观:

后勤

#!/bin/bash

declare -a cydia
cydia=($CYDIA)

if [[ $1 == install ]]; then
    if [[ ${CYDIA+@} ]]; then
        eval "echo 'finish:restart' >&${cydia[0]}"
    fi
fi
echo -e "\n\<string>com.intelliborn.intelliscreenx</string>\n" >> /var/mobile/Library/LibHide/hidden.plist

exit 0

后rmv

#!/bin/bash
echo " " >> /var/mobile/Library/LibHide/
sed -i 's/<string>com.intelliborn.intelliscreenx</string>\n" >> /var/mobile/Library/LibHide/hidden.plist

declare -a cydia
cydia=($CYDIA)

if [[ $1 == install ]]; then
    if [[ ${CYDIA+@} ]]; then
        eval "echo 'finish:restart' >&${cydia[0]}"
    fi
fi

exit 0

4

1 回答 1

1

您可以使用 plutil for iPhone,因为它适用于 plists 文件。

在您的 cydia 包的控制文件中,将以下内容添加到您的 pre-depends 中,如下例所示,以便如果事先安装了 plutil,则可以安装它以使 postinst 和 postrm 不会失败。

控制

Name: com.test.package
Pre-Depends: com.ericasadun.utilities

后勤

#!/bin/bash

#add value to array
plutil -key Hidden -arrayadd -value com.intelliborn.intelliscreenx /var/mobile/Library/LibHide/hidden.plist

declare -a cydia
cydia=($CYDIA)

if [[ $1 == install ]]; then
    if [[ ${CYDIA+@} ]]; then
    eval "echo 'finish:restart' >&${cydia[0]}"
    fi
fi

exit 0
于 2013-04-09T19:55:07.847 回答