From 90b2f9981991fb042615d12ac22b714d83ed3d42 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Thu, 21 Jan 2016 16:19:36 -0800 Subject: wl_clone: Bail out if WLROOT doesn't already exist It's better for the user to be aware of where things are going to be built and installed. --- wl_clone | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/wl_clone b/wl_clone index 49ff824..f98256c 100755 --- a/wl_clone +++ b/wl_clone @@ -8,34 +8,35 @@ clone_or_update() { - repo=$1 - dest=$(basename $repo) + repo=$1 + dest=$(basename $repo) - if [ ! -d ${WLROOT} ]; then - mkdir -p ${WLROOT} - fi - cd ${WLROOT} - echo - echo $dest - if [ ! -d ${dest} ]; then + cd ${WLROOT} + if [ $? != 0 ]; then + echo "Error: Could not cd to ${WLROOT}. Does it exist?" + exit 1 + fi + echo + echo $dest + if [ ! -d ${dest} ]; then git clone ${repo} ${dest} if [ $? != 0 ]; then echo "Error: Could not clone repository" exit 1 fi - fi - cd ${dest} - git checkout master - if [ $? != 0 ]; then + fi + cd ${dest} + git checkout master + if [ $? != 0 ]; then echo "Error: Problem checking out master" exit 1 - fi - git pull - if [ $? != 0 ]; then + fi + git pull + if [ $? != 0 ]; then echo "Error: Could not pull from upstream" exit 1 - fi - cd ${WLROOT} + fi + cd ${WLROOT} } clone_or_update git://anongit.freedesktop.org/wayland/wayland -- cgit v1.2.3