address shellcheck issues
This commit is contained in:
parent
ab0f55c059
commit
2a7e215c8b
@ -35,7 +35,7 @@ if ! command -v wget > /dev/null; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(uname -m) == "e2k" ]; then
|
if [ "$(uname -m)" == "e2k" ]; then
|
||||||
echo "This script is for emulating Elbrus and you're already running on this architecture"
|
echo "This script is for emulating Elbrus and you're already running on this architecture"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -47,7 +47,7 @@ echo "unpack image and install binfmt_misc rule\n"
|
|||||||
read -p "Did you read and understood the message above? [Yn] " yn
|
read -p "Did you read and understood the message above? [Yn] " yn
|
||||||
|
|
||||||
case $yn in
|
case $yn in
|
||||||
[yY|""] ) echo "Continuing..."; break;;
|
[yY|""] ) echo "Continuing..."; ;;
|
||||||
[nN] ) echo "Exiting"; exit 0;;
|
[nN] ) echo "Exiting"; exit 0;;
|
||||||
[*] ) echo "Unrecognized answer"; exit 1;;
|
[*] ) echo "Unrecognized answer"; exit 1;;
|
||||||
esac
|
esac
|
||||||
@ -55,14 +55,14 @@ esac
|
|||||||
set -x
|
set -x
|
||||||
|
|
||||||
git clone https://git.mentality.rip/OpenE2K/qemu-e2k -b $QEMU_BRANCH --depth=1 || exit 2
|
git clone https://git.mentality.rip/OpenE2K/qemu-e2k -b $QEMU_BRANCH --depth=1 || exit 2
|
||||||
pushd qemu-e2k
|
pushd qemu-e2k || exit 2
|
||||||
./configure --target-list=e2k-linux-user --static $QEMU_BUILD_FLAGS
|
./configure --target-list=e2k-linux-user --static $QEMU_BUILD_FLAGS || exit 2
|
||||||
make -j$(nproc)
|
make -j$(nproc) || exit 2
|
||||||
popd
|
popd || exit 2
|
||||||
|
|
||||||
for i in ${MIRRORS[@]}; do
|
for i in "${MIRRORS[@]}"; do
|
||||||
echo -n "Probing mirror $i..."
|
echo -n "Probing mirror $i..."
|
||||||
if wget -q -O/dev/null $i; then
|
if wget -q -O/dev/null "$i"; then
|
||||||
SELECTED_MIRROR=$i
|
SELECTED_MIRROR=$i
|
||||||
|
|
||||||
echo "OK"
|
echo "OK"
|
||||||
@ -72,14 +72,14 @@ for i in ${MIRRORS[@]}; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z $SELECTED_MIRROR ]; then
|
if [ -z "$SELECTED_MIRROR" ]; then
|
||||||
echo "Can't find working mirror, exiting..."
|
echo "Can't find working mirror, exiting..."
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
qemu_register_interpreter() {
|
qemu_register_interpreter() {
|
||||||
echo "Setting $qemu as binfmt interpreter for $cpu"
|
echo "Setting $qemu as binfmt interpreter for $cpu"
|
||||||
qemu_generate_register | sudo tee /proc/sys/fs/binfmt_misc/register
|
qemu_generate_register | sudo tee /proc/sys/fs/binfmt_misc/register || exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_generate_register() {
|
qemu_generate_register() {
|
||||||
@ -88,14 +88,14 @@ qemu_generate_register() {
|
|||||||
echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
|
echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
|
||||||
}
|
}
|
||||||
|
|
||||||
wget -Odocker.txz $SELECTED_MIRROR$IMAGE_PATH
|
wget -Odocker.txz "$SELECTED_MIRROR$IMAGE_PATH"
|
||||||
mkdir -p $CHROOT_DIR || exit 2
|
mkdir -p $CHROOT_DIR || exit 2
|
||||||
pushd $CHROOT_DIR
|
pushd $CHROOT_DIR
|
||||||
sudo tar -xJf ../docker.txz || exit 2
|
sudo tar -xJf ../docker.txz || exit 2
|
||||||
sudo cp ../qemu-e2k/build/qemu-e2k usr/bin
|
sudo cp ../qemu-e2k/build/qemu-e2k usr/bin || exit 2
|
||||||
|
|
||||||
# Change default mirror in case if ivk is unreachable (it's kinda stupid to block non-Russian IP addresses, isn't it?)
|
# Change default mirror in case if ivk is unreachable (it's kinda stupid to block non-Russian IP addresses, isn't it?)
|
||||||
if [ $SELECTED_MIRROR != "http://elbrus.ivk.ru/pub" ]; then
|
if [ "$SELECTED_MIRROR" != "http://elbrus.ivk.ru/pub" ]; then
|
||||||
sed "s|http://elbrus.ivk.ru/pub|$SELECTED_MIRROR|g" etc/apt/sources.list.d/ivk.list | sudo tee etc/apt/sources.list.d/mirror.list
|
sed "s|http://elbrus.ivk.ru/pub|$SELECTED_MIRROR|g" etc/apt/sources.list.d/ivk.list | sudo tee etc/apt/sources.list.d/mirror.list
|
||||||
|
|
||||||
sudo mv etc/apt/sources.list.d/ivk.list etc/apt/sources.list.d/ivk.list.disabled
|
sudo mv etc/apt/sources.list.d/ivk.list etc/apt/sources.list.d/ivk.list.disabled
|
||||||
@ -109,7 +109,7 @@ for cpu in ${qemu_target_list} ; do
|
|||||||
mask=$(eval echo \$${cpu}_mask)
|
mask=$(eval echo \$${cpu}_mask)
|
||||||
qemu_register_interpreter
|
qemu_register_interpreter
|
||||||
done
|
done
|
||||||
popd
|
popd || exit 2
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user