File: create-release-tarball.sh

package info (click to toggle)
ocsinventory-server 2.8.1%2Bdfsg1%2B~2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 23,212 kB
  • sloc: javascript: 318,983; php: 29,162; perl: 8,925; sql: 5,101; xml: 2,902; sh: 1,662; python: 77; makefile: 29
file content (62 lines) | stat: -rwxr-xr-x 1,813 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
set -e

# Branch name (first args)
BRANCH=$1

# Release name (second args)
RELEASE_NAME=$2

# URL to the ocs server git repository
SRV_REPO=https://github.com/OCSInventory-NG/OCSInventory-Server.git
# URL to the ocs reports git repository
WEB_REPO=https://github.com/OCSInventory-NG/OCSInventory-OCSReports.git
# Composer path
COMPOSER_PATH=/usr/bin/composer

# If no branch is supplied exit 
if [ -z $BRANCH ]; then
	echo "Please set a source branch (first argument)"
	exit 1
fi

if [ -z $RELEASE_NAME ]; then
	echo "Please set a release name (second argument)"
	exit 1
fi
echo "$COMPOSER_PATH"
# Check if composer bin is available, otherwise exit and display an error
if [ ! -f $COMPOSER_PATH ]; then
	echo "Error retreving composer executable. Please verify if composer is intalled or the COMPOSER_PATH configuration at the begining of the file (Currently used COMPOSER_PATH = $COMPOSER_PATH)"
	exit 1
fi

# Clone server repository and remove git related files
git clone $SRV_REPO -b $BRANCH
rm -rf OCSInventory-Server/.git
rm -rf OCSInventory-Server/.github
rm -rf OCSInventory-Server/.gitignore

# Clone reports repository and remove git related files
cd OCSInventory-Server && git clone $WEB_REPO -b $BRANCH ocsreports
rm -rf ocsreports/.git
rm -rf ocsreports/.github
rm -rf ocsreports/.gitignore

# Reset the default settings so install.php will be correctly loaded
rm ocsreports/dbconfig.inc.php
cd ocsreports/

# Run composer on ocsreports
$COMPOSER_PATH install

# Go back to the base path
cd ../..

# Change name to comply with OCS' naming convention
mv OCSInventory-Server OCSNG_UNIX_SERVER-$RELEASE_NAME
tar cfz OCSNG_UNIX_SERVER-$RELEASE_NAME.tar.gz OCSNG_UNIX_SERVER-$RELEASE_NAME
rm -rf OCSNG_UNIX_SERVER-$RELEASE_NAME

# Release created !
echo "Release has been successfully created"