merge prepare script into make

ansible
Peter Babič 3 years ago
parent 99e999b9e0
commit 120f72f439
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 54
      make.sh
  2. 20
      prepare.sh

@ -11,7 +11,6 @@ cd tmp/
sudo pacman -q -S --needed base-devel ncurses zlib gawk git gettext openssl libxslt wget unzip python gnupg sudo pacman -q -S --needed base-devel ncurses zlib gawk git gettext openssl libxslt wget unzip python gnupg
sysupgradeFile="openwrt-$version-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin"
sumsFile="sha256sums" sumsFile="sha256sums"
ascFile="$sumsFile.asc" ascFile="$sumsFile.asc"
@ -23,7 +22,7 @@ gpgOutput=$(gpg --status-fd 1 --auto-key-retrieve --with-fingerprint --verify "$
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "SIGNATURE VERIFIED" echo "SIGNATURE VERIFIED"
else else
echo "SIGNATURE INVALID. Exitting." echo "SIGNATURE INVALID. Exiting."
exit 1 exit 1
fi fi
@ -39,37 +38,50 @@ else
exit 1 exit 1
fi fi
touch -a "$sysupgradeFile" sysupgradeFile="openwrt-$version-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin"
touch -a "$archive"
## Note: it is possible to download a release sysupgrade file here,
## and consecutively get sha256sums verified,
## but it will later get replaced by `cp "bin/targets/ ...`
# wget -nc "$dlUrl/$sysupgradeFile" -O "$sysupgradeFile"
wget -nc "$dlUrl/$archive" -O "$archive"
sha256sum --ignore-missing -c "$sumsFile" sha256sum --ignore-missing -c "$sumsFile"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "SHA256SUM VERIFIED" echo "SHA256SUM VERIFIED"
else else
echo "SHA256SUM INVALID. Attempting new download." echo "SHA256SUM INVALID. Exiting."
wget "$dlUrl/$archive" -O "$archive"
wget "$dlUrl/$sysupgradeFile" -O "$sysupgradeFile"
rm -rf "$folderName" rm -rf "$folderName"
tar xJf "$archive" exit 1
fi
sha256sum --ignore-missing -c "$sumsFile"
if [ $? -eq 0 ]; then if [ ! -d "$folderName" ]; then
echo "SHA256SUM VERIFIED." tar xJf "$archive"
else
echo "SHA256SUM INVALID. Exiting."
exit 1
fi
fi fi
cd "$folderName" cd "$folderName"
ln -sf ../../files . ln -sf ../../files .
make image PROFILE=ArcherMR200 PACKAGES="curl" FILES=files/ make image PROFILE=ArcherMR200 PACKAGES="curl" FILES=files/
imageName="openwrt-$version-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin" cp "bin/targets/ramips/mt7620/$sysupgradeFile" ../../build/
cp "bin/targets/ramips/mt7620/$imageName" ../../build/ cd ../../build/
bootloaderFile="ArcherMR200_bootloader.bin"
recoveryFile="ArcherC2V1_tp_recovery.bin"
stockFirmware="../firmware/Archer MR200v1_0.9.1_1.2_up_boot_v004a.0 Build 180502 Rel.53881n.bin"
dd bs=512 obs=512 skip=1 count=256 if="$stockFirmware" of="$bootloaderFile"
cat "$bootloaderFile" "$sysupgradeFile" > "$recoveryFile"
atftpDir="/srv/atftp"
sudo pacman -S --needed atftp
sudo mkdir -p "$atftpDir"
sudo cp "$recoveryFile" "$atftpDir"
sudo chown -R atftp:atftp "$atftpDir"
sudo ifconfig enp0s31f6 192.168.0.66/23
sudo systemctl start atftpd.service
echo "Now connect the MR200 router via LAN1 and restart it while holding WPS button."
cd ../../

@ -1,20 +0,0 @@
#/bin/bash
sysupgradeUrl="http://downloads.openwrt.org/releases/19.07.7/targets/ramips/mt7620"
sysupgradeFile="openwrt-19.07.7-ramips-mt7620-ArcherMR200-squashfs-sysupgrade.bin"
bootloaderFile="ArcherMR200_bootloader.bin"
recoveryFile="ArcherC2V1_tp_recovery.bin"
dd bs=512 obs=512 skip=1 count=256 if=Archer\ MR200v1_0.9.1_1.2_up_boot_v004a.0\ Build\ 180502\ Rel.53881n.bin of="$bootloaderFile"
cat "$bootloaderFile" "$sysupgradeFile" > "$recoveryFile"
atftpDir="/srv/atftp"
sudo pacman -S atftp
sudo mkdir -p "$atftpDir"
sudo cp "$recoveryFile" "$atftpDir"
sudo chown -R atftp:atftp "$atftpDir"
sudo ifconfig enp0s31f6 192.168.0.66/23
sudo systemctl start atftpd.service
echo "Now connect the MR200 router via LAN1 and restart it while holding WPS button."
Loading…
Cancel
Save