]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - shell/bashrc
- let cp-kde-i18n choose source arch
[projects/pld-ftp-admin.git] / shell / bashrc
1 # .bashrc - file executed when executing bash
2
3 # Put your local aliases here
4 alias rmpkg=~/pld-ftp-admin/scripts/remove.py
5 alias gen-indexes=~/pld-ftp-admin/scripts/gen-indexes.py
6 alias dump-locks=~/pld-ftp-admin/scripts/dump-locks.py
7
8 testmvpkg() {
9         from="$1"
10         to="$2"
11         ~/pld-ftp-admin/scripts/test-move.py "$@" || return $?
12         shift 2
13         if [ "$to" = "PLD" -o "$to" = "updates" ]; then
14                 echo >&2 "Checking signatures"
15                 testsignpkg "$@" || return $?
16         fi
17 }
18
19 mvpkg() {
20         __wrap_signpkg() {
21                 shift 2
22                 testsignpkg "$@" || return $?
23         }
24         if [ "$2" = "PLD" -o "$2" = "updates" ]; then
25                 __wrap_signpkg "$@" || return $?
26         fi
27         ~/pld-ftp-admin/scripts/move.py "$@" || return $?
28 }
29
30 alias ls='ls --color=auto -BFN --show-control-chars'
31 alias l='ls -lh'
32 alias la='ls -la'
33 alias du='du -h'
34 alias df='df -Th'
35 alias vi='vim'
36 alias h='history $(($LINES-6))'
37
38 # glen ;)
39 if [ "${SSH_CONNECTION%% *}" = "194.106.120.90" ]; then
40         [ -f /usr/share/okas/bashrc ] && . /usr/share/okas/bashrc
41 fi
42
43 cp-kde-i18n() {
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"
53                 return
54         fi
55
56         for arch in amd64 alpha athlon i386 i586 i686 ppc sparc; do
57                 if [ "$arch" = "$sarch" ]; then
58                         continue
59                 fi
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
65 touchpkg() {
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
75 signpkg() {
76         local pkg=$1
77         if [ ! -f $pkg ]; then
78                 echo >&2 "signpkg: Specify existing info file"
79                 return
80         fi
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}' | \
83         xargs -r rpm --resign
84 }
85
86 testsignpkg() {
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
109 unlocktree() {
110         local tree="$1"
111         (
112         cd ~/pld-ftp-admin/modules
113         python -c "
114 import ftpio
115 ftpio.connect()
116 ftpio.unlock('$tree')
117 "
118         )
119 }
This page took 0.045973 seconds and 3 git commands to generate.