-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
69 lines (49 loc) · 1.78 KB
/
install.sh
File metadata and controls
69 lines (49 loc) · 1.78 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
#! /bin/bash
chmod -R o+x ./*.rb
zbdir='/tmp/zurfbirb-'
for i in {0..20}; do zbdir+=$(printf "%x" $(($RANDOM%16)) )
done
zbfname='zb-s-'
for i in {0..20}; do zbfname+=$(printf "%x" $(($RANDOM%16)) )
done
zbfname+='.txt'
keyfiledir=$HOME/'zurfbirb_for_apache'
if [ ! -d $keyfiledir ]
then
mkdir $keyfiledir
fi
keyfname='zb-private-'
for i in {0..20}; do keyfname+=$(printf "%x" $(($RANDOM%16)) )
done
keyfname+='.key'
# set doc root if working in same directory as repo
# docroot='\nDOC_ROOT = "'$PWD'"'
# but in reality the repo gets unpacked into a subfolder, so doc root needs to be one level up
docroot='\nDOC_ROOT = "'${PWD%/*}'"'
linestowrite='\n$zb_sess_dirname = "'$zbdir'"\n$zb_sess_filename = "'$zbfname'"\n$zb_sess_crypt_key_file = "'$keyfiledir/$keyfname'"\n'
echo -e "$docroot\n$(cat config/config.rb)\n" > config/config.rb
echo -e $linestowrite >> config/sess-file-vars.rb
echo 'Private key directory was set to '$keyfiledir
echo 'Session file directory was set to '$zbdir
echo "Final step - need to finalize setup of a directory. On some Linux systems it will ask you for your password (not root's) to run this step as root."
sudo chown -R www-data:www-data $keyfiledir
# remove .gitignore files from otherwise empty directories
# they only exist because GitHub doesn't allow empty directories
rm templates/.gitignore
rm html/.gitignore
rm component_fns/.gitignore
rm scripts/.gitignore
rm public_auto_urls/.gitignore
rm forms/.gitignore
rm assets/images/.gitignore
rm assets/styles/.gitignore
# remove .git and .gitigore
rm -Rf .git
rm -f .gitignore
# move files out of the zurfbirb folder, first backing up the old .htaccess
mv ../.htaccess ../OLD_htaccess
mv -ft .. ./*
# move dotfiles, which would not otherwise be moved
mv -ft .. ./.*
# delete this script
# shred -u install.sh