-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
74 lines (59 loc) · 2.2 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -eu
GH_REPO='supechicken/ChromeOS-AutoLogin'
RELEASE_VERSION=v0.1.1
ARCH="$(uname -m)"
# prevent conflict between system libraries and Chromebrew libraries
unset LD_LIBRARY_PATH
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
function remount_rootfs() {
echo '[+] Trying to remount root filesystem in read/write mode...'
mount -o remount,rw / && return 0 || return $?
}
function remove_rootfs_verification() {
# KERN-A B for arm, ROOT-A B for x64
if [[ "${ARCH}" == 'aarch64' ]];then
/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 2
/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 4
else
/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 3
/usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 5
fi
echo -e "${YELLOW}Please run this script again after reboot.${RESET}"
echo '[+] Rebooting in 3 seconds...'
sleep 3
reboot
}
if [[ ${EUID} != 0 ]]; then
echo -e "${RED}Please run this script as root.${RESET}" >&2
exit 1
fi
if ! remount_rootfs; then
echo -e "${YELLOW}Remount failed. Did you disable rootFS verification?${RESET}" >&2
read -N1 -p 'Disable rootFS verification now? (This will reboot your system) [Y/n]: ' response
echo -e '\n'
case $response in
Y|y)
remove_rootfs_verification
;;
*)
echo 'No changes made.'
exit 1
;;
esac
fi
cd /tmp
echo '[+] Downloading ChromeOS-AutoLogin...'
curl -L# "https://github.com/${GH_REPO}/releases/download/${RELEASE_VERSION}/cros-autologin-${ARCH}" -o cros-autologin
curl -L# "https://github.com/${GH_REPO}/raw/main/upstart/cros-autologin.conf" -o cros-autologin.conf
echo '[+] Installing...'
install -Dm755 cros-autologin /usr/local/bin/
install -Dm644 cros-autologin.conf /etc/init/
read -sp 'Enter your Google account password (will be stored locally, protected by Unix permission): ' password
mkdir -p /usr/local/etc/cros-autologin/
echo -n "${password}" > /usr/local/etc/cros-autologin/password
echo -en '\n\n'
echo '[+] Setting up file permission...'
chown -R root:root /usr/local/etc/cros-autologin
chmod -R 600 /usr/local/etc/cros-autologin
echo '[+] All done! Reboot and try if it works.'