-
Notifications
You must be signed in to change notification settings - Fork 1
/
package
executable file
·87 lines (46 loc) · 1020 Bytes
/
package
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
#!/bin/sh
DIR=./pkg
rm $DIR imd.7z -rf
mkdir $DIR -p
echo "Building static..."
make clean
make build CFLAGS="-static"
echo "Making package..."
mkdir $DIR/usr/bin/ -p
mkdir $DIR/etc/imd/ -p
mkdir $DIR/usr/share/man/man1/ -p
cp ./bin/imd $DIR/usr/bin/imd
cp ./doc/* $DIR/etc/imd/
cp ./imd.1.gz $DIR/usr/share/man/man1/imd.1.gz
cp ./LICENSE.TXT $DIR/etc/imd/LICENSE
cp ./rebuild/makefile $DIR/etc/imd/makefile
echo "Generating hashes..."
cd $DIR
sha256sum -b \
./etc/imd/LICENSE ./etc/imd/man.md \
./usr/bin/imd \
./usr/share/man/man1/imd.1.gz > ./.HASH
cd ..
echo "Creating install script..."
cat <<EOF > $DIR/.INT
#!/bin/sh
echo "Installing no dependancy IMD."
echo "Running sha256 sum check..."
if [ "\$(sha256sum -c .HASH)" ]
then
sudo cp * / -rv
echo "Installed!"
exit 0
fi
echo "Hash check faild!"
exit 1
EOF
chmod a+x $DIR/.INT
echo "Compressing..."
cd $DIR
7z a ../imd.7z ./
cd ..
echo "Checking archive..."
7z h ./imd.7z
echo "Deleting package directory..."
rm -rf $DIR