]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - shell/bashrc
- let cp-kde-i18n choose source arch
[projects/pld-ftp-admin.git] / shell / bashrc
CommitLineData
48a5f713
ER
1# .bashrc - file executed when executing bash
2
3# Put your local aliases here
05de4f7a
ER
4alias rmpkg=~/pld-ftp-admin/scripts/remove.py
5alias gen-indexes=~/pld-ftp-admin/scripts/gen-indexes.py
6alias dump-locks=~/pld-ftp-admin/scripts/dump-locks.py
48a5f713
ER
7
8testmvpkg() {
1cc3ca51
ER
9 from="$1"
10 to="$2"
48a5f713
ER
11 ~/pld-ftp-admin/scripts/test-move.py "$@" || return $?
12 shift 2
03cd48a6 13 if [ "$to" = "PLD" -o "$to" = "updates" ]; then
1cc3ca51
ER
14 echo >&2 "Checking signatures"
15 testsignpkg "$@" || return $?
16 fi
48a5f713
ER
17}
18
19mvpkg() {
20 __wrap_signpkg() {
21 shift 2
22 testsignpkg "$@" || return $?
23 }
03cd48a6 24 if [ "$2" = "PLD" -o "$2" = "updates" ]; then
1cc3ca51
ER
25 __wrap_signpkg "$@" || return $?
26 fi
48a5f713
ER
27 ~/pld-ftp-admin/scripts/move.py "$@" || return $?
28}
29
30alias ls='ls --color=auto -BFN --show-control-chars'
31alias l='ls -lh'
32alias la='ls -la'
33alias du='du -h'
34alias df='df -Th'
35alias vi='vim'
36alias h='history $(($LINES-6))'
37
10d8f296
ER
38# glen ;)
39if [ "${SSH_CONNECTION%% *}" = "194.106.120.90" ]; then
40 [ -f /usr/share/okas/bashrc ] && . /usr/share/okas/bashrc
41fi
42
48a5f713 43cp-kde-i18n() {
cb327400
ER
44 local sarch=$1
45 local info=$2
46
47 if [ -z "$sarch" -o ! -f "$info" ]; then
48 echo >&2 "Usage: cp-kde-i18n [SOURCE ARCH] [INFO FILE]"
49 return
50 fi
51 if [ $(grep -c "^file:$sarch:" "$info") = 0 ]; then
52 echo >&2 "cp-kde-i18n: $sarch doesn't look like arch that has packages built"
48a5f713
ER
53 return
54 fi
55
cb327400
ER
56 for arch in amd64 alpha athlon i386 i586 i686 ppc sparc; do
57 if [ "$arch" = "$sarch" ]; then
58 continue
59 fi
48a5f713
ER
60 awk -F: -vsarch=$sarch '/^file:/ && $2 == sarch {print $3}' $info | xargs -ri cp -al ../../$sarch/RPMS/{} ../../$arch/RPMS
61 awk -F: -vsarch=$sarch -varch=$arch '/^file:/ && $2 == sarch {printf("%s:%s:%s\n", $1, arch, $3)}' $info >> $info
62 done
63}
64
268dd9e0
ER
65touchpkg() {
66 local pkg=$1
67 if [ ! -f $pkg ]; then
68 echo >&2 "touchpkg: Specify existing info file"
69 return
70 fi
71 awk -F: '/^file:/{arch=$2; file=$3; printf("../../%s/RPMS/%s\n", arch, file)}' "$@" | \
72 xargs -l512 -r touch
73}
74
48a5f713
ER
75signpkg() {
76 local pkg=$1
77 if [ ! -f $pkg ]; then
78 echo >&2 "signpkg: Specify existing info file"
79 return
80 fi
21d37883
ER
81 echo "$@" | xargs awk -F: '/^file:/{arch=$2; file=$3; printf("../../%s/RPMS/%s\n", arch, file)}' | \
82 xargs -l1 -I '%{F}' rpm --nodigest --nosignature -qp --qf '%|SIGGPG?{}:{%{F}\n}|' '%{F}' | \
aafa73a9 83 xargs -r rpm --resign
48a5f713
ER
84}
85
86testsignpkg() {
87 local pkg=$1
88 if [ ! -f $pkg ]; then
89 echo >&2 "testsignpkg: Specify existing info file"
90 return
91 fi
92 local out
93 out=$(
94 awk -F: '/^file:/{arch=$2; file=$3; printf("../../%s/RPMS/%s\n", arch, file)}' "$@" | \
95 xargs -l512 \
96 rpm -qp --qf '%{name}-%{version}-%{release}.%{arch} %{siggpg}\n' 2>/dev/null | \
97 fgrep '(none)' | \
98 sed -e 's,^,ERR: ,;s,(none),is not signed,'
99 )
100
101 if [ "$out" ]; then
102 echo "$out"
103 return 1
104 else
105 return 0
106 fi
107}
108
109unlocktree() {
110 local tree="$1"
111 (
112 cd ~/pld-ftp-admin/modules
113 python -c "
114import ftpio
115ftpio.connect()
116ftpio.unlock('$tree')
117"
118 )
119}
This page took 0.069393 seconds and 4 git commands to generate.