Skip to content
Permalink
Browse files

Add synchronize cache script

  • Loading branch information...
synapticvoid committed Mar 27, 2017
1 parent 1ce7647 commit c6a814c27eb95e7767377d2b39f5b8d8d9886e36
@@ -6,6 +6,7 @@

*.pyc
.vagrant/
/cache/

# compiled output
/dist
@@ -2,7 +2,7 @@

cd utils
./init-common.sh
./init-full.sh
./download-raspbian.sh
./prepare-sysroot-full.sh
./prepare-sysroot-minimal.sh
./switch-sysroot.sh full
@@ -0,0 +1,74 @@
#!/bin/bash

source ${0%/*}/common.sh

function usage() {
cat <<EOF
Usage: $0 [options]
-h| --help Display help text.
-n| --no-download If the Raspbian image is present, do not download it again.
-d| --directory Destination directory where Raspbian image is downloaded.
EOF
}

while [[ $# -gt 0 ]]; do
KEY="$1"
case $KEY in
-h|--help)
DISPLAY_HELP=true
;;
-n|--no-download)
NO_DOWNLOAD=true
;;
-d|--directory)
DIRECTORY_ARG="$2"
;;

*)
;;
esac
shift
done

if [[ $DISPLAY_HELP ]]; then
usage
exit 0
fi

if [[ -z $DIRECTORY_ARG ]]; then
cd_root
else
BASE_DIRECTORY=$DIRECTORY_ARG
mkdir -p $BASE_DIRECTORY/raspbian
cd $BASE_DIRECTORY
fi

cd raspbian

message 'Download Raspbian image'

function download_raspbian() {
# Download and unzip the latest raspbian image (~1.4Go zipped)
message 'Downloading Raspbian latest image'
wget --output-document=${RASPBIAN_BASENAME}.zip \
--content-disposition \
https://downloads.raspberrypi.org/raspbian_latest

unzip -p ${RASPBIAN_BASENAME}.zip > ${RASPBIAN_BASENAME}.img
}

if [[ -f ${RASPBIAN_BASENAME}.img ]]; then
if [[ ! $NO_DOWNLOAD ]]; then
while true; do
read -p "You already have a raspbian image, do you want to download the lastest version [y/n]? " yn
case $yn in
[Yy]* ) download_raspbian; break;;
[Nn]* ) break;;
esac
done
fi
else
download_raspbian;
fi

@@ -16,14 +16,5 @@ cd_root

mkdir raspi raspbian bin logs

# Get the toolchain (~600Mo)
message 'Downloading Raspberry Pi toolchain'
pushd raspi
git clone https://github.com/raspberrypi/tools

pushd tools
git pull origin master
popd

popd
$UTILS_DIR/synchronize-toolchain.sh

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,14 @@
#!/bin/bash

source ${0%/*}/common.sh

CACHE_ROOT='cache'
MODULES_DIR=$CACHE_ROOT/modules

message "Creating cache directory $CACHE_DIR"
mkdir -p $MODULES_DIR

./utils/synchronize-toolchain.sh --directory $CACHE_ROOT
./utils/download-raspbian.sh --no-download --directory $CACHE_ROOT
./utils/synchronize-qt-modules.sh --directory $MODULES_DIR

@@ -1,7 +1,6 @@
#!/bin/bash

source ${0%/*}/common.sh
cd_root

MODULES_DIR='modules'
TAG_NAME=$QT_VERSION
@@ -12,6 +11,7 @@ Usage: $0 [options]
-h| --help Display help text.
-c| --clean-all Delete all repositories and output data.
-d| --directory Destination directory where Qt modules are cloned.
EOF
}

@@ -25,6 +25,9 @@ while [[ $# -gt 0 ]]; do
-c|--clean-all)
CLEAN_ALL=true
;;
-d|--directory)
DIRECTORY_ARG="$2"
;;

*)
;;
@@ -37,6 +40,12 @@ if [[ $DISPLAY_HELP ]]; then
exit 0
fi

if [[ -z $DIRECTORY_ARG ]]; then
cd_root
else
MODULES_DIR=$DIRECTORY_ARG
fi

if [[ $CLEAN_ALL ]]; then
message 'Clean all repositories and output...'
rm -rf $MODULES_DIR
@@ -0,0 +1,52 @@
#!/bin/bash
source ${0%/*}/common.sh

function usage() {
cat <<EOF
Usage: $0 [options]
-h| --help Display help text.
-d| --directory Destination directory where the toolchain is downloaded.
EOF
}

while [[ $# -gt 0 ]]; do
KEY="$1"
case $KEY in
-h|--help)
DISPLAY_HELP=true
;;
-d|--directory)
DIRECTORY_ARG="$2"
;;

*)
;;
esac
shift
done

if [[ $DISPLAY_HELP ]]; then
usage
exit 0
fi

if [[ -z $DIRECTORY_ARG ]]; then
cd_root
else
BASE_DIRECTORY=$DIRECTORY_ARG
mkdir -p $BASE_DIRECTORY/raspi
cd $BASE_DIRECTORY
fi

cd raspi

message 'Downloading Raspberry Pi toolchain'

if [[ ! -d 'tools' ]]; then
git clone https://github.com/raspberrypi/tools
fi

pushd tools
git pull origin master
popd

0 comments on commit c6a814c

Please sign in to comment.
You can’t perform that action at this time.