1 Star 0 Fork 0

FydeOS / misc-scripts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
enroll_helper.sh 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
Noodles 提交于 2021-06-10 12:01 . append to chrome_dev
#!/bin/bash
set -o errexit
readonly CLOBBER_FILE="/mnt/stateful_partition/.update_available"
readonly CHROME_DEV_FILE="/etc/chrome_dev.conf"
mount_rw() {
mount -o remount,rw /
}
mount_ro() {
mount -o remount,ro /
}
check_user() {
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root or prepend sudo, abort."
exit 1
fi
}
set_chrome_dev() {
if grep -q "fydeos-device-management-url" "$CHROME_DEV_FILE"; then
echo "The flag fydeos-device-management-url may have been set"
else
echo "Add fydeos-device-management-url to chrome_dev file"
echo "--fydeos-device-management-url=https://policy.demo.fydeos.com/" >> "$CHROME_DEV_FILE"
fi
}
clobber() {
echo "Reset device"
echo "clobber" > "$CLOBBER_FILE"
}
exec_command() {
mount_rw
set_chrome_dev
clobber
mount_ro
}
warn_then_exec() {
while true; do
read -p "This script will reset the deivce, all user data will be wiped, continue? (Y/N) " c
case $c in
[Yy]* ) exec_command; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
}
done_msg() {
echo "Done, please reboot the device."
}
main() {
check_user
warn_then_exec
done_msg
}
main "$@"
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

搜索帮助