aboutsummaryrefslogtreecommitdiff
path: root/kernel/kernel-aletta/kernel-aletta.SlackBuild
blob: 7325906690fd0fa6edbd4f52247209820450a668 (plain)
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
#!/bin/bash
#
# slackbuild for kernel-aletta
#

CWD="`pwd`"

if [ -f ~/.slackbuildrc ]; then
  source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
  source /etc/slackbuildrc
fi

PACKAGE="kernel-aletta"
KERNEL_VERSION="2.6.18"
EXTRAVERSION="2"
ARCH="i386"
BUILD="2rha"
PATCHSET="vs2.0.2.2-rc6" # previous was vs2.0.2-rc22
TMP=${TMP:=/tmp}
SRC_DIR=${SRC:=$CWD}
REPOS=${REPOS:=$TMP}

if [ ! -z "$EXTRAVERSION" ]; then
  KERNEL_VERSION=$KERNEL_VERSION.$EXTRAVERSION
fi

PATCH_VERSION="$KERNEL_VERSION-$PATCHSET"

RTOOL="wget"
KERNEL="linux-$KERNEL_VERSION.tar.bz2"
PATCH="patch-$PATCH_VERSION.diff"
KERNEL_URL="http://www.kernel.org/pub/linux/kernel/v2.6/$KERNEL"
PATCH_URL="http://vserver.13thfloor.at/Experimental/$PATCH"
SRC_DIR="$SRC_DIR/kernel"

mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ]; then

  if [ ! -f "$SRC_DIR/$KERNEL" ]; then
    rm -f $SRC_DIR/$KERNEL.sign
    wget "$KERNEL_URL" -O "$SRC_DIR/$KERNEL"
    wget "$KERNEL_URL.sign" -O "$SRC_DIR/$KERNEL.sign"
  fi

  if [ ! -f "$SRC_DIR/$PATCH" ]; then
    wget "$PATCH_URL" -O "$SRC_DIR/$PATCH"
  fi

fi

TMP="$TMP/$PACKAGE"
mkdir -p $TMP
cd $TMP

rm -rf linux-$KERNEL_VERSION*
tar jxvf $SRC_DIR/$KERNEL

if [ ! -z "$PATCHSET" ]; then
  mv linux-$KERNEL_VERSION linux-$KERNEL_VERSION-$PATCHSET
  KERNEL_VERSION="$KERNEL_VERSION-$PATCHSET"
fi

cp $CWD/config-$KERNEL_VERSION linux-$KERNEL_VERSION/.config
cd linux-$KERNEL_VERSION

patch -p1 < $SRC_DIR/$PATCH

if [ ! -z "$EXTRAVERSION" ] && [ ! -z "$PATCHSET" ]; then
  sed -e "s/^EXTRAVERSION =*$/EXTRAVERSION = \.$EXTRAVERSION-$PATCHSET/" Makefile > Makefile.tmp
elif [ ! -z "$PATCHSET" ]; then
  sed -e "s/^EXTRAVERSION =*$/EXTRAVERSION = -$PATCHSET/" Makefile > Makefile.tmp
fi
mv Makefile.tmp Makefile

make oldconfig
time make

# make the package

PKG="$TMP/package-$PACKAGE"

mkdir -p $PKG/{install,boot,usr/doc}

cp System.map $PKG/boot/System.map-$KERNEL_VERSION
cp .config $PKG/boot/config-$KERNEL_VERSION
cp arch/$ARCH/boot/bzImage $PKG/boot/vmlinuz-$KERNEL_VERSION

cat << EOF > $PKG/install/slack-desc
kernel-aletta: kernel-aletta (kernel for aletta server station)
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
kernel-aletta:
EOF

VERSION="`echo $KERNEL_VERSION | sed -e 's/-/_/g'`"

# docs
mkdir -p $PKG/usr/doc/$PACKAGE-$VERSION
for file in COPYING CREDITS MAINTAINERS README REPORTING-BUGS; do
  cp $file* $PKG/usr/doc/$PACKAGE-$VERSION/
done

cd $PKG

( cd boot && ln -s vmlinuz-$KERNEL_VERSION vmlinuz )
( cd boot && ln -s config-$KERNEL_VERSION config )
( cd boot && ln -s System.map-$KERNEL_VERSION System.map)

makepkg -c y -l y $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi