1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-09 15:40:45 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Elias Kotlyar
2018-05-29 22:15:01 +02:00
4 changed files with 10 additions and 93 deletions

View File

@@ -3,11 +3,7 @@
# Github autodownload script
# See usage for help
# Edit the global variables to change the repo and initial folder
<<<<<<< HEAD
# Depends on curl, jq (json parser), openssl (SHA calculation)
=======
# Depends on curl, jq (jason parser), openssl (SHA calculation)
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
# owner name and repo name
REPO="EliasKotlyar/Xiaomi-Dafang-Hacks"
@@ -19,7 +15,6 @@ REMOTEFOLDER="firmware_mod"
DESTFOLDER="./"
DESTOVERRIDE="/tmp/Update"
# The list of exclude, can have multple filter with "*.conf|*.sh"
<<<<<<< HEAD
EXCLUDEFILTER="*.conf|*.user"
GITHUBURL="https://api.github.com/repos"
GITHUBURLRAW="https://raw.githubusercontent.com"
@@ -27,25 +22,9 @@ CURL="/system/sdcard/bin/curl -k"
JQ="/system/sdcard/bin/jq"
SHA="/system/sdcard/bin/openssl dgst -sha256"
BASENAME="/system/sdcard/bin/busybox basename"
=======
EXCLUDEFILTER=""
#"*.conf|*.user|run.sh|osd|autoupdate.sh|libcrypto.so.42|curl|curl.bin|libssl.so.44|libz.so.1"
# Somme URL
GITHUBURL="https://api.github.com/repos"
GITHUBURLRAW="https://raw.githubusercontent.com"
CURL="curl -k"
JQ="jq"
SHA="openssl dgst -sha256"
BASENAME="basename"
#CURL="/system/sdcard/bin/curl -k"
#JQ="/system/sdcard/bin/jq"
#SHA="/system/sdcard/bin/openssl dgst -sha256"
#BASENAME="/system/sdcard/bin/busybox basename"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
TMPFILE=/tmp/udpate.tmp
BACKUPEXT=.backup
LASTGLOBALCOMMIT=""
_PRINTONLY=0
_V=0
_FORCE=0
@@ -155,17 +134,10 @@ getfiles()
countdownreboot()
{
i=10
<<<<<<< HEAD
while [ ${i} -gt 0 ];
do
echo "$i seconds remaining before reboot (Press control-c to abort)";
i=$((${i} - 1))
=======
while [ $i -gt 0 ];
do
echo "$i seconds remaining before rebooting (control-c to abort)";
i=`expr $i - 1`;
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
sleep 1;
done
action reboot
@@ -213,11 +185,7 @@ do
esac
done
<<<<<<< HEAD
log "Starting AutoUpdate"
=======
log "Start"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
if [ ${_FORCE} = 1 ]; then
log "Forcing update."
@@ -233,11 +201,7 @@ fi
action "rm -rf ${DESTOVERRIDE} 2>/dev/null"
<<<<<<< HEAD
log "Getting list of remote files."
=======
log "Get list of files"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
FIRST=$(${CURL} -s ${GITHUBURL}/${REPO}/contents/${REMOTEFOLDER}?ref=${BRANCH})
FILES=$(getfiles "${FIRST}")
# For all the repository files
@@ -249,21 +213,13 @@ do
# Remove files that match the filter
res=$(ismatch ${LOCALFILE})
if [ "$res" == "match" ]; then
<<<<<<< HEAD
echo "${LOCALFILE} is excluded due to filter."
=======
echo "${LOCALFILE} is excluded due to filter"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
continue
fi
# Get the file temporally to calculate SHA
${CURL} -s ${i} -o ${TMPFILE} 2>/dev/null
if [ ! -f ${TMPFILE} ]; then
<<<<<<< HEAD
echo "Can not get remote file $i, exiting."
=======
echo "Can not get remote file $i, exit"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
exit 1
fi
@@ -275,29 +231,18 @@ do
# log "SHA of $LOCALFILE is ${LOCALSHA} ** remote is ${REMOTESHA}"
if [ "${REMOTESHA}" = "${LOCALSHA}" ] ; then
<<<<<<< HEAD
echo "${LOCALFILE} is up to date."
else
if [ ${_FORCE} = 1 ]; then
echo "${LOCALFILE} updated."
=======
echo "${LOCALFILE} is OK"
else
if [ ${_FORCE} = 1 ]; then
echo "${LOCALFILE} updated"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
if [ ${_BACKUP} = 1 ]; then
action cp ${LOCALFILE} ${DESTOVERRIDE}/${LOCALFILE}${BACKUPEXT}
fi
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
else
<<<<<<< HEAD
echo "${LOCALFILE} needs to be updated. Overwrite?"
echo "[Y]es or [N]o or [A]ll?"
=======
echo "${LOCALFILE} need to be updated, overwrite [Y]es or [N]o or [A]ll ?"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not updated"
@@ -317,7 +262,6 @@ do
fi
else
if [ ${_FORCE} = 1 ]; then
<<<<<<< HEAD
echo "${LOCALFILE} created."
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
@@ -327,16 +271,6 @@ do
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not created."
=======
echo "${LOCALFILE} created"
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
else
echo "${LOCALFILE} doesn't exist, create it [Y]es or [N]o or [A]ll ?"
rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not created"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rm -f ${TMPFILE} 2>/dev/null
else
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
@@ -350,7 +284,6 @@ do
done
if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) > 1 ]; then
<<<<<<< HEAD
echo "--------------- Stopping services ---------"
for i in /system/sdcard/controlscripts/*; do
echo stopping $i
@@ -369,29 +302,11 @@ if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) >
else
echo "A reboot is needed, do you want to reboot now?"
echo "[Y]es or [N]o"
=======
echo "--------------- Stop services ---------"
echo "--------------- Update files ----------"
action "cp -Rf ${DESTOVERRIDE}/* ${DESTFOLDER} 2>/dev/null"
action "rm -Rf ${DESTOVERRIDE}/* 2>/dev/null"
echo "--------------- Reboot ----------"
if [ ${_FORCEREBOOT} = 1 ]; then
countdownreboot
else
echo "reboot is needed, do you want to do it now ?"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
rep=$(ask_yes_or_no )
if [ "${rep}" = "yes" ]; then
countdownreboot
fi
fi
else
<<<<<<< HEAD
echo "No files to update."
=======
echo "No updated files, no action"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
fi

Binary file not shown.

Binary file not shown.

View File

@@ -3,4 +3,6 @@
1. Download the [custom_vendors.xml](custom_vendors.xml) configuration file
2. Open tinyCam and go to settings -> Developer Settings -> Custom brand XML file -> Choose custom_vendors.xml
3. Restart tinyCam
4. Run tinyCam and select Brand -> Xiaomi and Model -> Custom Application Layer
4. Run tinyCam and select Brand -> XiaomiHack and Model -> Dafang EliasKotlyar
Note: A Custom_vendors.xml 'file not found' error can happen due to tinyCam not taking the correct path from file manager. Make sure it is not prefixed with 'document' etc.