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 # Github autodownload script
# See usage for help # See usage for help
# Edit the global variables to change the repo and initial folder # 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 (json parser), openssl (SHA calculation)
=======
# Depends on curl, jq (jason parser), openssl (SHA calculation)
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
# owner name and repo name # owner name and repo name
REPO="EliasKotlyar/Xiaomi-Dafang-Hacks" REPO="EliasKotlyar/Xiaomi-Dafang-Hacks"
@@ -19,7 +15,6 @@ REMOTEFOLDER="firmware_mod"
DESTFOLDER="./" DESTFOLDER="./"
DESTOVERRIDE="/tmp/Update" DESTOVERRIDE="/tmp/Update"
# The list of exclude, can have multple filter with "*.conf|*.sh" # The list of exclude, can have multple filter with "*.conf|*.sh"
<<<<<<< HEAD
EXCLUDEFILTER="*.conf|*.user" EXCLUDEFILTER="*.conf|*.user"
GITHUBURL="https://api.github.com/repos" GITHUBURL="https://api.github.com/repos"
GITHUBURLRAW="https://raw.githubusercontent.com" GITHUBURLRAW="https://raw.githubusercontent.com"
@@ -27,25 +22,9 @@ CURL="/system/sdcard/bin/curl -k"
JQ="/system/sdcard/bin/jq" JQ="/system/sdcard/bin/jq"
SHA="/system/sdcard/bin/openssl dgst -sha256" SHA="/system/sdcard/bin/openssl dgst -sha256"
BASENAME="/system/sdcard/bin/busybox basename" 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 TMPFILE=/tmp/udpate.tmp
BACKUPEXT=.backup BACKUPEXT=.backup
LASTGLOBALCOMMIT=""
_PRINTONLY=0 _PRINTONLY=0
_V=0 _V=0
_FORCE=0 _FORCE=0
@@ -67,7 +46,7 @@ usage()
echo "-v (--verbose) for verbose" echo "-v (--verbose) for verbose"
echo "-u (--user) githup login/password (not mandatory, but sometime anonymous account get banned)" echo "-u (--user) githup login/password (not mandatory, but sometime anonymous account get banned)"
echo "-h (--help) for this help" echo "-h (--help) for this help"
echo echo
echo "Note that ${EXCLUDEFILTER} will be excluded" echo "Note that ${EXCLUDEFILTER} will be excluded"
echo "Examples:" echo "Examples:"
echo "Update all files if needed >$1 -d /system/sdcard (-f to force update)" echo "Update all files if needed >$1 -d /system/sdcard (-f to force update)"
@@ -154,19 +133,12 @@ getfiles()
# Let some time before rebooting # Let some time before rebooting
countdownreboot() countdownreboot()
{ {
i=10 i=10
<<<<<<< HEAD while [ ${i} -gt 0 ];
while [ ${i} -gt 0 ]; do
do echo "$i seconds remaining before reboot (Press control-c to abort)";
echo "$i seconds remaining before reboot (Press control-c to abort)";
i=$((${i} - 1)) i=$((${i} - 1))
======= sleep 1;
while [ $i -gt 0 ];
do
echo "$i seconds remaining before rebooting (control-c to abort)";
i=`expr $i - 1`;
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
sleep 1;
done done
action reboot action reboot
} }
@@ -213,11 +185,7 @@ do
esac esac
done done
<<<<<<< HEAD
log "Starting AutoUpdate" log "Starting AutoUpdate"
=======
log "Start"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
if [ ${_FORCE} = 1 ]; then if [ ${_FORCE} = 1 ]; then
log "Forcing update." log "Forcing update."
@@ -233,11 +201,7 @@ fi
action "rm -rf ${DESTOVERRIDE} 2>/dev/null" action "rm -rf ${DESTOVERRIDE} 2>/dev/null"
<<<<<<< HEAD
log "Getting list of remote files." log "Getting list of remote files."
=======
log "Get list of files"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
FIRST=$(${CURL} -s ${GITHUBURL}/${REPO}/contents/${REMOTEFOLDER}?ref=${BRANCH}) FIRST=$(${CURL} -s ${GITHUBURL}/${REPO}/contents/${REMOTEFOLDER}?ref=${BRANCH})
FILES=$(getfiles "${FIRST}") FILES=$(getfiles "${FIRST}")
# For all the repository files # For all the repository files
@@ -249,21 +213,13 @@ do
# Remove files that match the filter # Remove files that match the filter
res=$(ismatch ${LOCALFILE}) res=$(ismatch ${LOCALFILE})
if [ "$res" == "match" ]; then if [ "$res" == "match" ]; then
<<<<<<< HEAD
echo "${LOCALFILE} is excluded due to filter." echo "${LOCALFILE} is excluded due to filter."
=======
echo "${LOCALFILE} is excluded due to filter"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
continue continue
fi fi
# Get the file temporally to calculate SHA # Get the file temporally to calculate SHA
${CURL} -s ${i} -o ${TMPFILE} 2>/dev/null ${CURL} -s ${i} -o ${TMPFILE} 2>/dev/null
if [ ! -f ${TMPFILE} ]; then if [ ! -f ${TMPFILE} ]; then
<<<<<<< HEAD
echo "Can not get remote file $i, exiting." echo "Can not get remote file $i, exiting."
=======
echo "Can not get remote file $i, exit"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
exit 1 exit 1
fi fi
@@ -275,29 +231,18 @@ do
# log "SHA of $LOCALFILE is ${LOCALSHA} ** remote is ${REMOTESHA}" # log "SHA of $LOCALFILE is ${LOCALSHA} ** remote is ${REMOTESHA}"
if [ "${REMOTESHA}" = "${LOCALSHA}" ] ; then if [ "${REMOTESHA}" = "${LOCALSHA}" ] ; then
<<<<<<< HEAD
echo "${LOCALFILE} is up to date." echo "${LOCALFILE} is up to date."
else else
if [ ${_FORCE} = 1 ]; then if [ ${_FORCE} = 1 ]; then
echo "${LOCALFILE} updated." 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" action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
if [ ${_BACKUP} = 1 ]; then if [ ${_BACKUP} = 1 ]; then
action cp ${LOCALFILE} ${DESTOVERRIDE}/${LOCALFILE}${BACKUPEXT} action cp ${LOCALFILE} ${DESTOVERRIDE}/${LOCALFILE}${BACKUPEXT}
fi fi
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE} action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
else else
<<<<<<< HEAD
echo "${LOCALFILE} needs to be updated. Overwrite?" echo "${LOCALFILE} needs to be updated. Overwrite?"
echo "[Y]es or [N]o or [A]ll?" 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 ) rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not updated" echo "${LOCALFILE} not updated"
@@ -317,7 +262,6 @@ do
fi fi
else else
if [ ${_FORCE} = 1 ]; then if [ ${_FORCE} = 1 ]; then
<<<<<<< HEAD
echo "${LOCALFILE} created." echo "${LOCALFILE} created."
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null" action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE} action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
@@ -327,18 +271,8 @@ do
rep=$(ask_yes_or_no ) rep=$(ask_yes_or_no )
if [ "${rep}" = "no" ]; then if [ "${rep}" = "no" ]; then
echo "${LOCALFILE} not created." 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 rm -f ${TMPFILE} 2>/dev/null
else else
action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null" action "mkdir -p $(dirname ${DESTOVERRIDE}/${LOCALFILE}) 2>/dev/null"
action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE} action mv ${TMPFILE} ${DESTOVERRIDE}/${LOCALFILE}
fi fi
@@ -350,7 +284,6 @@ do
done done
if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) > 1 ]; then if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) > 1 ]; then
<<<<<<< HEAD
echo "--------------- Stopping services ---------" echo "--------------- Stopping services ---------"
for i in /system/sdcard/controlscripts/*; do for i in /system/sdcard/controlscripts/*; do
echo stopping $i echo stopping $i
@@ -369,29 +302,11 @@ if [ -d ${DESTOVERRIDE} ] && [ $(ls -l ${DESTOVERRIDE}/* | wc -l 2>/dev/null) >
else else
echo "A reboot is needed, do you want to reboot now?" echo "A reboot is needed, do you want to reboot now?"
echo "[Y]es or [N]o" 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 ) rep=$(ask_yes_or_no )
if [ "${rep}" = "yes" ]; then if [ "${rep}" = "yes" ]; then
countdownreboot countdownreboot
fi fi
fi fi
else else
<<<<<<< HEAD
echo "No files to update." echo "No files to update."
=======
echo "No updated files, no action"
>>>>>>> 571126e1e29240593c07125be9f83d21471dc9d0
fi 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 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 2. Open tinyCam and go to settings -> Developer Settings -> Custom brand XML file -> Choose custom_vendors.xml
3. Restart tinyCam 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.