Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe7b1735 authored by vincent's avatar vincent
Browse files

remove useless scripts

parent 23b9068f
Loading
Loading
Loading
Loading

linux/clean-lock-files.sh

deleted100755 → 0
+0 −49
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: CABLES_LOCKED_PATH device identifier
# $2: DEVICES_LOCKED_PATH path to the /e/ archive to flash
# $3: HEIMDALL_LOCKED_PATH path to the /e/ archive to flash

# Exit status
# - 101 : CABLES_LOCKED_PATH missing
# - 102 : DEVICES_LOCKED_PATH missing
# - 103 : HEIMDALL_LOCKED_PATH missing

CABLES_LOCKED_PATH=$1
DEVICES_LOCKED_PATH=$2
HEIMDALL_LOCKED_PATH=$3

if [ -z $CABLES_LOCKED_PATH ]
then
  exit 101
fi

if [ -z $DEVICES_LOCKED_PATH ]
then
  exit 102
fi

if [ -z $HEIMDALL_LOCKED_PATH ]
then
  exit 103
fi

rm -f ${CABLES_LOCKED_PATH}/*
rm -f ${DEVICES_LOCKED_PATH}/*
rm -f ${HEIMDALL_LOCKED_PATH}

linux/get-androidfilehost.sh

deleted100755 → 0
+0 −101
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: ANDROIDFILEHOST_ARCHIVE_URL
# $2: ANDROIDFILEHOST_FOLDER (will be created if doesn't exist)

# Exit status
# - 0 : /e/ downloaded
# - 1 : Generic error code (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 2 : Parse error—for instance, when parsing command-line options, the ‘.wgetrc’ or ‘.netrc’... (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 3 : File I/O error (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 4 : Network failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 5 : SSL verification failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 6 : Username/password authentication failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 7 : Protocol errors (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 8 : Server issued an error response (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html)
# - 10: No internet connection
# - 11: Invalid file downloaded
# - 101 : ANDROIDFILEHOST_ARCHIVE_URL missing
# - 102 : ANDROIDFILEHOST_FOLDER missing

ANDROIDFILEHOST_ARCHIVE_URL=$1
ANDROIDFILEHOST_FOLDER=$2

function check_md5sum () {

  echo "Check MD5SUM"

  FILE_ID=$1
  FILE_MD5_CHECKSUM=$2

  curl 'https://androidfilehost.com/?fid='${FILE_ID} -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3' --compressed -H 'Referer: https://forum.xda-developers.com/galaxy-s9/samsung-galaxy-s9--s9-cross-device-development/twrp-exynos-t3763464' -H 'DNT: 1' -H 'Connection: keep-alive' -H $'Cookie: UTGv2=h4983524ab157374df94cc761ef73be85b70; CookieConsent={stamp:\'csW+0Aawj1W6ZMT4uWQanbx3DTe2sCrqs92Ip4HDhJy8avDOk2UUOw==\'%2Cnecessary:true%2Cpreferences:true%2Cstatistics:true%2Cmarketing:true%2Cver:2}; SPSI=b30cb85e78c681802c3d5fac79b44a57; afh=3be1e70712a60dafd5b6d31d77a3da2d; PRLST=XT; DSR=z6qqi2Hd/HniLiqH20k5BdYaMnXhLxC5PbVJiuucTClMmhOZ5wg+TOOuGXLJRc4tWWDIEBPHjZSnnodsWDIxOw==; DCSS=086342F4FAC33D11EFB678A1E206AC6CD490112; DGCC=Vx; DCST=pE9; adOtr=bc38beO75c8' -H 'Upgrade-Insecure-Requests: 1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: Trailers' | grep ${FILE_MD5_CHECKSUM}

  exit $?
}

if ! curl -s -IL https://gitlab.e.foundation | grep -q "^HTTP\/2 200"
then
  exit 10
fi

if [ -z ${ANDROIDFILEHOST_FOLDER} ]
then
  exit 101
fi

if [ -z ${ANDROIDFILEHOST_ARCHIVE_URL} ]
then
  exit 102
fi

mkdir -p ${ANDROIDFILEHOST_FOLDER}
FILENAME=$(basename ${ANDROIDFILEHOST_ARCHIVE_URL})
FILE_ID=$(echo $ANDROIDFILEHOST_ARCHIVE_URL | sed 's/.*\/\(.*\)\/.*\.zip/\1/')
## URL_archive: https://qc1.androidfilehost.com/dl/xZsqRpunddhlcq1PO6SVlQ/1559982137/962187416754474353/no-verity-opt-encrypt-samsung-1.0.zip

if [ -f ${ANDROIDFILEHOST_FOLDER}/${FILENAME} ] && [ -f ${ANDROIDFILEHOST_FOLDER}/${FILENAME}.md5sum ]
then


  FILE_MD5_CHECKSUM=$(cat ${ANDROIDFILEHOST_FOLDER}/${FILENAME}.md5sum | sed 's/\(.*\)  .*/\1/')

  check_md5sum ${FILE_ID} ${FILE_MD5_CHECKSUM}

  SUM_OK=$?
  if [ ${SUM_OK} = 0 ]
  then
    exit 0
  fi

fi

wget -O ${ANDROIDFILEHOST_FOLDER}/${FILENAME} ${ANDROIDFILEHOST_ARCHIVE_URL}

md5sum ${ANDROIDFILEHOST_FOLDER}/${FILENAME} > ${ANDROIDFILEHOST_FOLDER}/${FILENAME}.md5sum

FILE_MD5_CHECKSUM=$(cat ${ANDROIDFILEHOST_FOLDER}/${FILENAME}.md5sum | sed 's/\(.*\)  .*/\1/')

check_md5sum ${FILE_ID} ${FILE_MD5_CHECKSUM}

SUM_OK=$?
if [ ${SUM_OK} != 0 ]
then
  rm ${FILENAME}
  exit 11
fi

linux/lock-cable.sh

deleted100755 → 0
+0 −50
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# TODO: Does the loop have to be inside this script? Timeout?

# Parameter
# $1: CABLES_LOCKED_FOLDER temp folder where are stored locked cables

# Return
# - displayed: CABLE the cable locked (blue|red|green)

# Exit status
# - 0 : Lock file created for cable
# - 101 : CABLES_LOCKED_FOLDER missing
# - 102 : CABLE_COLOR missing
# - 103 : cable already locked

CABLES_LOCKED_FOLDER=$1
CABLE_COLOR=$2

if [ -z $CABLES_LOCKED_FOLDER ]
then
  exit 101
fi

if [ -z $CABLE_COLOR ]
then
  exit 102
fi

if [ -f ${CABLES_LOCKED_FOLDER}/${CABLE_COLOR}.lock ]
then
  exit 103
fi

mkdir -p ${CABLES_LOCKED_FOLDER} && touch ${CABLES_LOCKED_FOLDER}/${CABLE_COLOR}.lock

linux/lock-device.sh

deleted100755 → 0
+0 −42
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# TODO: what if folder doesn't exist? Give folder+device id

# Parameter
# $1: DEVICE_LOCKED_PATH file to lock device

# Exit status
# - 0 : Lock file created for device
# - 10 : Device already locked
# - 101 : DEVICE_LOCKED_PATH missing

DEVICE_LOCKED_PATH=$1

if [ -z $DEVICE_LOCKED_PATH ]
then
  exit 101
fi

if [ -f ${DEVICE_LOCKED_PATH} ]
then
  exit 10
fi

mkdir -p $(dirname ${DEVICE_LOCKED_PATH})

touch ${DEVICE_LOCKED_PATH}

linux/lock-download.sh

deleted100755 → 0
+0 −43
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# TODO: Does the loop have to be inside this script? Timeout?

# Parameter
# $1: HEIMDALL_LOCKED_PATH lock file for Heimdall

# Exit status
# - 0 : Lock file created for Heimdall
# - 101 : HEIMDALL_LOCKED_PATH missing

HEIMDALL_LOCKED_PATH=$1

if [ -z $HEIMDALL_LOCKED_PATH ]
then
  exit 101
fi

if [ -f ${HEIMDALL_LOCKED_PATH} ]
then

  while [ -f ${HEIMDALL_LOCKED_PATH} ]
  do
    sleep 1
  done
fi

touch ${HEIMDALL_LOCKED_PATH}
Loading