summarylogtreecommitdiffstats
path: root/nconfig-wrapper
blob: 2b2b881d0f10f4c1d2a74023f47e5d347197ac87 (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
#!/bin/bash
[ -a ./nconfig-wrapper ] || {
    echo "You have to run this from the same directory!"
    exit 1
}
croak()        { echo "ERROR: $@"; exit; }
[ -f /etc/bash.functions ] && . /etc/bash.functions
[ -f /usr/share/ppz/bash.functions ] && . /usr/share/ppz/bash.functions
[ "$1" ] && REPO="$1" || croak USAGE: ./package-this [repo-directory]
[ -d ${REPO} ] || croak ${REPO} not mounted!
ldir=src/linux-3.0

makepkg -oecd
mold=($(md5sum config.x86_64))
sed -i 's/^[#]*\s*\(return\s*1\)$/\1/ig' PKGBUILD
makepkg -cd
cd $ldir
make nconfig
cd ../..
diff config.x86_64 $ldir/.config

askyn "update package?" && {
	 cat config.x86_64 > $ldir/.config
	 mnew=($(md5sum config.x86_64))
	 sed -i s_${mold[0]}_${mnew[0]}_ig PKGBUILD
	 pkgrel=0
	 eval  $(sed 's/^pkgrel=/\0/i;t;d;' PKGBUILD)
	 let pkgrel++
	 sed -i 's/^pkgrel=.*$/pkgrel='$pkgrel'/i' PKGBUILD
	 sed -i 's/^[#]*\s*\(return\s*1\)$/#  \1/ig' PKGBUILD
	 makepkg -oecd
	 makepkg -cd
	 PF=$(ls -1Atr linux-linode-*.pkg.tar.xz | tail -n 1)
	 mv "${PF}" "${REPO}"/
	 repo-add "${REPO}"/hir.db.tar.gz "${REPO}/${PF}"
	 IFS=$'\n'
	 for file in $(ls -1Atr "${REPO}"/linux-linode-*.pkg.tar.xz | head -n -1); do
		  rm -i "$file"
	 done
} || {
	 sed -i 's/^[#]*\s*\(return\s*1\)$/#  \1/ig' PKGBUILD
	 makepkg -oecd
}

git diff --color=auto