BusyBox tar does not support gz; use plain tar archives
This commit is contained in:
parent
919a275fe3
commit
cbdf3860b0
12
build-tgr.sh
12
build-tgr.sh
@ -51,12 +51,12 @@ cp target/keys/signingpub.pem target/overlay/pub.pem
|
|||||||
echo "[+] Generating sample update package"
|
echo "[+] Generating sample update package"
|
||||||
mkdir -p home/update
|
mkdir -p home/update
|
||||||
echo "sample update" > home/update/sample.txt
|
echo "sample update" > home/update/sample.txt
|
||||||
tar -cvzf update.tgz home
|
tar -cvf update.tar home
|
||||||
openssl dgst -sha256 -sign target/keys/signingkey.pem -out update.tgz.sig update.tgz
|
openssl dgst -sha256 -sign target/keys/signingkey.pem -out update.tar.sig update.tar
|
||||||
cat update.tgz > update.tgz.cc
|
cat update.tar > update.tar.cc
|
||||||
cat update.tgz.sig >> update.tgz.cc
|
cat update.tar.sig >> update.tar.cc
|
||||||
mv update.tgz.cc target/overlay
|
mv update.tar.cc target/overlay
|
||||||
rm -rf home update.tgz update.tgz.sig
|
rm -rf home update.tar update.tar.sig
|
||||||
|
|
||||||
echo "[+] Generating Monitoring SSH Key"
|
echo "[+] Generating Monitoring SSH Key"
|
||||||
ssh-keygen -t ecdsa -f target/keys/sshkey -q -N ""
|
ssh-keygen -t ecdsa -f target/keys/sshkey -q -N ""
|
||||||
|
@ -15,7 +15,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
pubkey="/pub.pem"
|
pubkey="/pub.pem"
|
||||||
file="/tmp/update.tgz.cc"
|
file="/tmp/update.tar.cc"
|
||||||
|
/bin/chmod 777 $file
|
||||||
/bin/echo "### ccOS Update Script ###"
|
/bin/echo "### ccOS Update Script ###"
|
||||||
/bin/echo "[+] Starting"
|
/bin/echo "[+] Starting"
|
||||||
/bin/sleep 1
|
/bin/sleep 1
|
||||||
@ -25,19 +26,17 @@ if [[ -L $file ]]
|
|||||||
then
|
then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
/bin/dd if=/tmp/update.tgz.cc of=sig bs=1 count=256 skip=$skip
|
/bin/dd if=/tmp/update.tar.cc of=sig bs=1 count=256 skip=$skip
|
||||||
/usr/bin/truncate -s $skip update.tgz.cc
|
/usr/bin/truncate -s $skip $file
|
||||||
check=`/usr/bin/openssl dgst -sha256 -verify $pubkey -signature /tmp/sig /tmp/update.tgz.cc`
|
check=`/usr/bin/openssl dgst -sha256 -verify $pubkey -signature /tmp/sig $file`
|
||||||
if [ "$check" == "Verified OK" ]
|
if [ "$check" == "Verified OK" ]
|
||||||
then
|
then
|
||||||
/bin/echo "[+] Signature is valid!"
|
/bin/echo "[+] Signature is valid!"
|
||||||
/bin/echo "[+] Upgrading..."
|
/bin/echo "[+] Upgrading..."
|
||||||
/bin/tar -xvzf /tmp/update.tgz.cc -C /
|
/bin/tar -xvf $file -C /
|
||||||
/bin/rm /tmp/update.tgz.cc /tmp/sig
|
/bin/rm $file /tmp/sig
|
||||||
/bin/echo "[+] Done"
|
/bin/echo "[+] Done"
|
||||||
exit 0
|
|
||||||
else
|
else
|
||||||
/bin/echo "[-] Signature error, exiting..."
|
/bin/echo "[-] Signature error, exiting..."
|
||||||
/bin/rm /tmp/update.tgz.cc /tmp/sig
|
/bin/rm $file /tmp/sig
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user