1 Star 0 Fork 0

FydeOS/misc-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
modify_appid.sh 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
FydeOSGitBot 提交于 2020-09-23 12:51 +08:00 . screen output fix
#!/bin/bash
set -o errexit
readonly LSB_RELEASE="/etc/lsb-release"
readonly BOARD_NAME_KEY="CHROMEOS_RELEASE_BOARD"
readonly APPID_KEY="CHROMEOS_BOARD_APPID"
mount_rw() {
mount -o remount,rw /
}
mount_ro() {
mount -o remount,ro /
}
die() {
echo "$@"
mount_ro
exit 1
}
get_board() {
grep "$BOARD_NAME_KEY" "$LSB_RELEASE" | awk -F '=' '{print $2}'
}
set_appid() {
local appid="$1"
if [[ -z "$appid" ]]; then
die "No valid appid detected, abort."
fi
sed -i "s|^\($APPID_KEY\)={.*}$|\1={$appid}|" "$LSB_RELEASE"
echo -e "\nModified appid to $appid successfully, all done.\n\n"
}
check_user() {
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root or prepend sudo, abort."
exit 1
fi
}
main() {
check_user
mount_rw
local board
board="$(get_board)"
case "$board" in
"surface-pro4")
echo -e "\nSurface Pro 4 detected, proceed..."
set_appid "C8975970-2856-498A-8938-3570D7756CAF"
;;
"surface-pro5")
echo -e "\nSurface Pro 5 detected, proceed..."
set_appid "CF167F7B-C4AD-42F1-82F4-0598D0785ABE"
;;
"surface-pro6")
echo -e "\nSurface Pro 6 detected, proceed..."
set_appid "8E7644B3-3941-4E22-BC82-6625F947972F"
;;
*) die "No modification required, abort."
;;
esac
mount_ro
}
main "$@"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/fydeos_fyde/misc-scripts.git
git@gitee.com:fydeos_fyde/misc-scripts.git
fydeos_fyde
misc-scripts
misc-scripts
master

搜索帮助