forked from Froiden/fedmine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller
More file actions
executable file
·77 lines (62 loc) · 1.95 KB
/
installer
File metadata and controls
executable file
·77 lines (62 loc) · 1.95 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
pwd=$1
work_dir=$2
mkdir -p $work_dir
cd $pwd
if [ `which git` ] && [ `git rev-parse HEAD` ]; then
git submodule deinit --all --force
git submodule sync
git submodule update --init
git submodule foreach git checkout master
git submodule foreach git pull origin master
else
if [ `which curl` ]; then
DLAPP=`which curl`" -L -o __OUT__ __URL__"
elif [ `which wget` ]; then
DLAPP=`which wget`" --progress=dot -O __OUT__ __URL__"
else
exit 1
fi
modules=$(cat .gitmodules | tr -d '\n' | sed -e "/\[submodule \"[^\"]\+\"\]\s\+/{s//\n/g}" | sed -e "/\(\s*url = \)\?\(.*\?\)\t*path = \([^\t]\+\)\t*\(url = \)\?\(.*\)/{s//\3\t\2\5/g}" | awk '{$1=$1};1')
IFS=$'\n'
for module in $modules;
do
IFS=' ' read -ra repo <<< $module
api_url=${repo[1]/https:\/\/github.com/https:\/\/api.github.com\/repos}"/commits"
repo_sfn=${repo[0]/\//_}.commits
checksums=$pwd/SHA256SUMS
api=${DLAPP/__OUT__/\/tmp\/$repo_sfn}
api=${api/__URL__/$api_url}
eval $api
if [ ! -f $checksums ] || [ ! `grep $repo_sfn $checksums` ]; then
echo `sha256sum /dev/null | awk '{print $1}'`" /tmp/$repo_sfn" >> $checksums
fi
if ! `sha256sum --strict --status -c $checksums`; then
path=$work_dir/${repo[0]}
url=${repo[1]}"/archive/master.zip"
mkdir -p $path
download=${DLAPP/__OUT__/$path.zip}
download=${download/__URL__/$url}
mkdir -p $path
eval $download
unzip -o $path.zip -d $path
mv $path/*/* $path
rm $path.zip
fi
old_checksum=`grep $repo_sfn $checksums | awk '{print $1}'`
new_checksum=`sha256sum /tmp/$repo_sfn | awk '{print $1}'`
sed -i "s/$old_checksum/$new_checksum/" $checksums
rm /tmp/$repo_sfn
done
fi
cp -r . $work_dir/
if [ ! -f $work_dir/images/custom-logo.png ]; then
cp $work_dir/images/logo.png $work_dir/images/custom-logo.png
fi
rm -rf $work_dir/app
rm -rf $work_dir/config
rm -rf $work_dir/.git
rm -rf $work_dir/Gemfile
rm -rf $work_dir/installer
rm -rf $work_dir/lib
rm -rf $work_dir/init.rb