1
1
#! /bin/bash
2
+ # shellcheck disable=SC2155
2
3
3
- readonly THISSCRIPT=$0
4
- readonly THISDIR=$( dirname $0 )
4
+ readonly THISDIR=$( dirname " $0 " )
5
5
readonly TIMETAG=" $( date +%Y%m%d%H%M) "
6
6
readonly PACKAGES=" moulinette SSOwat yunohost yunohost-admin yunohost-portal"
7
7
readonly FORCE=" false"
8
8
9
- source $( dirname $THISSCRIPT ) /config/config
10
- mkdir -p $LAST_BUILDS_CACHE
9
+ source " $THISDIR /config/config"
10
+ mkdir -p " $LAST_BUILDS_CACHE "
11
11
12
12
function main()
13
13
{
@@ -19,7 +19,7 @@ function main()
19
19
echo " -------------------------------------"
20
20
echo " Looking for update in ${PACKAGE} for ${DISTRIB} ... "
21
21
22
- build_if_needed $PACKAGE $DISTRIB
22
+ build_if_needed " $PACKAGE " " $DISTRIB "
23
23
done
24
24
done
25
25
echo " -------------------------------------"
@@ -45,25 +45,25 @@ function build_if_needed()
45
45
fi
46
46
fi
47
47
48
- cd $GIT_REPOS /$PACKAGE
48
+ cd " $GIT_REPOS /$PACKAGE " || exit 1
49
49
50
50
git fetch origin > /dev/null 2> /dev/null
51
51
52
- git checkout $BRANCH_NIGHTLY > /dev/null 2> /dev/null
53
- git pull origin $BRANCH_NIGHTLY > /dev/null 2> /dev/null
54
- git reset --hard origin/$BRANCH_NIGHTLY
52
+ git checkout " $BRANCH_NIGHTLY " > /dev/null 2> /dev/null
53
+ git pull origin " $BRANCH_NIGHTLY " > /dev/null 2> /dev/null
54
+ git reset --hard " origin/$BRANCH_NIGHTLY "
55
55
56
56
# Check if build is needed
57
57
58
- if [ -e $LAST_BUILD_FOR_THIS_PACKAGE ]
58
+ if [ -e " $LAST_BUILD_FOR_THIS_PACKAGE " ]
59
59
then
60
- TIMESTAMP_LASTBUILD=$( stat -c %Y $LAST_BUILD_FOR_THIS_PACKAGE )
60
+ TIMESTAMP_LASTBUILD=$( stat -c %Y " $LAST_BUILD_FOR_THIS_PACKAGE " )
61
61
else
62
62
TIMESTAMP_LASTBUILD=0
63
63
fi
64
64
TIMESTAMP_HEAD=$( git show -s --format=%ct HEAD)
65
65
66
- if [ $TIMESTAMP_HEAD -lt $TIMESTAMP_LASTBUILD ]
66
+ if [ " $TIMESTAMP_HEAD " -lt " $TIMESTAMP_LASTBUILD " ]
67
67
then
68
68
if ! " $FORCE " ;
69
69
then
@@ -94,31 +94,31 @@ function build_if_needed()
94
94
# Launch the build using build_deb script
95
95
build
96
96
97
- touch $LAST_BUILD_FOR_THIS_PACKAGE
97
+ touch " $LAST_BUILD_FOR_THIS_PACKAGE "
98
98
99
99
# Restore changelog
100
100
echo " > Restoring previous changelog"
101
- cd $GIT_REPOS /$PACKAGE
101
+ cd " $GIT_REPOS /$PACKAGE " || exit 1
102
102
cp debian/changelog.old debian/changelog
103
103
rm debian/changelog.old
104
104
105
105
}
106
106
107
107
function build()
108
108
{
109
- # Create temporary folder
110
- TMP_FOLDER=$( mktemp -d)
111
-
112
- # Move files to a tmp folder
113
- echo " > Exporting in $TMP_FOLDER ... "
114
- git ls-files | xargs tar -czf archive.tar.gz
115
- cat archive.tar.gz | tar -xz -C $TMP_FOLDER
116
- rm archive.tar.gz
117
-
118
- # Build Debian package
119
- echo " > Starting build ..."
120
- cd $TMP_FOLDER
121
- $BUILD_DEB $DISTRIB " unstable" .
109
+ # Create temporary folder
110
+ TMP_FOLDER=$( mktemp -d)
111
+
112
+ # Move files to a tmp folder
113
+ echo " > Exporting in $TMP_FOLDER ... "
114
+ git ls-files | xargs tar -czf archive.tar.gz
115
+ tar xzf archive.tar.gz -C " $TMP_FOLDER "
116
+ rm archive.tar.gz
117
+
118
+ # Build Debian package
119
+ echo " > Starting build ..."
120
+ cd " $TMP_FOLDER " || exit 1
121
+ $BUILD_DEB " $DISTRIB " " unstable" .
122
122
}
123
123
124
124
main
0 commit comments