forked from Botspot/box86-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-box86
executable file
·36 lines (26 loc) · 1.03 KB
/
update-box86
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
#!/bin/bash
DIRECTORY="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
if [[ "$DIRECTORY" != ${HOME}* ]];then
DIRECTORY="$HOME"
fi
[ -e "${DIRECTORY}/box86.download" ] && rm -rf "${DIRECTORY}/box86.download"
mkdir "${DIRECTORY}/box86.download"
cd "${DIRECTORY}/box86.download" || error "Failed to enter ${DIRECTORY}/box86.download directory"
echo 'Downloading box86...'
wget https://archive.org/download/box86.7z_20200928/box86.tar.xz || error "Failed to download box86.tar.xz"
wget https://archive.org/download/box86.7z_20200928/box86sum.txt -O "${DIRECTORY}/box86.hash" || error "Failed to download box86.hash"
echo "Extracting box86..."
tar xf ./box86.tar.xz || error "Failed to extract box86.tar.xz"
rm -f ./box86.tar.xz
echo "Installing files..."
sudo cp -avf "$(pwd)/etc"/* /etc
sudo cp -avf "$(pwd)/usr"/* /usr
cd
rm -rf "${DIRECTORY}/box86.download"
echo "Refreshing binfmt..."
sudo systemctl restart systemd-binfmt || error "Failed to refresh systemd-binfmt"
echo -e "\nDone!"