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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
#
# Author: Chris Jones <[email protected]>
#
# Shell Script to build a .deb file from an .app package
# and upload the .deb file to a remote repository for
# hosting .deb files in Cydia
#
#
echo "Update Repo Script Started"

# Specify project directory
projdir=/Users/capin/Projects/KegCop

# Display projdir
echo "The project directory:"$projdir

#Display pwd
echo "The present working direcotry:"$PWD

# Change to KegCop Project directory

cd ~/Projects/KegCop

# Pseudo-Signing KegCop.app

ldid -S app/KegCop.app/KegCop

echo "Pseudo-Signed App"

# Copy KegCop.app build file/folder to ~/packages/KegCop/Applications/

cp -R app/KegCop.app ~/packages/KegCop/Applications/

cd ~/packages

echo "The present working direcotry:" $PWD

# Added 24DEC12 - build version 2 control file

# Update control file version to sync with current build of app

# Get current build version of KegCop

# Specify KegCop-Info.plist as a variable
file=$projdir/KegCop/KegCop-Info.plist

# extract contents of KegCop-Info.plist
# http://thenubbyadmin.com/2012/05/02/finding-os-x-version-and-build-information-from-the-command-line/
#

file_build=`grep -C 2 CFBundleVersion $file | grep -o '[0-9]\{3\}'`

# echo $file_build
echo "The current build is" $file_build

echo "The current directory is" $PWD

# figure out way to place / put $file_build into "control" file

# change to directory containing control file
cd ~/packages/KegCop/DEBIAN/

echo "The current directory is" $PWD

# place contents of $file_build variable into control file
sed -i -e "/Version/s/\(-...\)*$/-$file_build/" control

echo "Updated the control file."

# change directory to build package
cd ~/packages

# remove old packages from local repo before building new package

ls ~/repo/debs/

rm ~/repo/debs/*

# Build Debian package file

dpkg-deb -b KegCop ~/repo/debs

# Change to local repo directory

cd ~/repo

# Scan for packages in repo and update "Packages" file

echo "Creating <Packages> file."

dpkg-scanpackages debs / > Packages

# Build Packages compressed file

bzip2 -fks Packages

# Upload local repo to remote repository

cd ..

# Delete old files on remote repository

echo "Deleting remote files, then uploading new files to remote repo."

ssh -n crj 'rm -rf /home/ipatch/www/repo'

scp -r repo crj:/home/ipatch/www/

echo "Repo Updated"


# Cyida Repo Instructions
# 
# 1) Create a directory named "repo"
# 2) Create a directory named "packages"
# 3) Create a directory within "packages called "<AppName>"
# 4) Create a directory within "<AppName>" called "DEBIAN
# 5) Create a "control" within directory "DEBIAN"
# 5b) *Note* an empty line my be required at the end of the control file.
# 6) Create a debian package file from the "packages" directory $dpkg-deb -b <AppName> /path/to/debs/
# 7) Create a "Packages" file, $dpkg-scanpackages debs / > Packages
# 8) $bzip2 -fks Packages
# 9) *Note* a "Release" file is needed for repo information.