便利オプション

  • ${Package}.rpm の場合と ${Package} の場合があって指定がややこしい

-qs installed.rpm

  • 内容物がわかる
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# rpm -qs glusterfs-server-3.7.6-1.el6.x86_64|head
normal        /etc/glusterfs
normal        /etc/glusterfs/gluster-rsyslog-5.8.conf
normal        /etc/glusterfs/gluster-rsyslog-7.2.conf
normal        /etc/glusterfs/glusterd.vol
normal        /etc/glusterfs/glusterfs-georep-logrotate
normal        /etc/glusterfs/glusterfs-logrotate
normal        /etc/glusterfs/group-virt.example
normal        /etc/glusterfs/logger.conf.example
normal        /etc/init.d/glusterd
normal        /etc/init.d/glusterfsd

-qf /path/to/file

  • どのRPMでインストールされたディレクトリ or ファイルかわかる
1
2
# rpm -qf /etc/init.d/glusterd
glusterfs-server-3.7.6-1.el6.x86_64

-qp –scripts installed.rpm

  • インストール/アンインストール/アップデート時の処理内容がわかる
 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
# rpm -qp --scripts glusterfs-server-3.7.6-1.el6.x86_64.rpm
postinstall scriptlet (using /bin/sh):
# Legacy server
/sbin/chkconfig --add glusterd ;/sbin/chkconfig --add glusterfsd ;# ".cmd_log_history" is renamed to "cmd_history.log" in GlusterFS-3.7 .
# While upgrading glusterfs-server package form GlusterFS version <= 3.6 to
# GlusterFS version 3.7, ".cmd_log_history" should be renamed to
# "cmd_history.log" to retain cli command history contents.
if [ -f /var/log/glusterfs/.cmd_log_history  ]; then
    mv /var/log/glusterfs/.cmd_log_history \
       /var/log/glusterfs/cmd_history.log
fi

# Genuine Fedora (and EPEL) builds never put gluster files in /etc; if
# there are any files in /etc from a prior gluster.org install, move them
# to /var/lib. (N.B. Starting with 3.3.0 all gluster files are in /var/lib
# in gluster.org RPMs.) Be careful to copy them on the off chance that
# /etc and /var/lib are on separate file systems
if [ -d /etc/glusterd -a ! -h /var/lib/glusterd  ]; then
    mkdir -p /var/lib/glusterd
    cp -a /etc/glusterd /var/lib/glusterd
    rm -rf /etc/glusterd
    ln -sf /var/lib/glusterd /etc/glusterd
fi

# Rename old volfiles in an RPM-standard way.  These aren't actually
# considered package config files, so %config doesn't work for them.
if [ -d /var/lib/glusterd/vols  ]; then
    for file in $(find /var/lib/glusterd/vols -name '*.vol'); do
        newfile=${file}.rpmsave
        echo "warning: ${file} saved as ${newfile}"
        cp ${file} ${newfile}
    done
fi

# add marker translator
# but first make certain that there are no old libs around to bite us
# BZ 834847
if [ -e /etc/ld.so.conf.d/glusterfs.conf  ]; then
    rm -f /etc/ld.so.conf.d/glusterfs.conf
    /sbin/ldconfig
fi


pidof -c -o %PPID -x glusterd &> /dev/null
if [ $? -eq 0  ]; then
    kill -9 `pgrep -f gsyncd.py` &> /dev/null

    killall --wait glusterd &> /dev/null
    glusterd --xlator-option *.upgrade=on -N

    #Cleaning leftover glusterd socket file which is created by glusterd in
    #rpm_script_t context.
    rm -rf /var/run/glusterd.socket

    # glusterd _was_ running, we killed it, it exited after *.upgrade=on,
    # so start it again
    /sbin/service glusterd start &>/dev/null ;else
    glusterd --xlator-option *.upgrade=on -N

    #Cleaning leftover glusterd socket file which is created by glusterd in
    #rpm_script_t context.
    rm -rf /var/run/glusterd.socket
fi

##-----------------------------------------------------------------------------
## All %preun should be placed here and keep them sorted
##
preuninstall scriptlet (using /bin/sh):
if [ $1 -eq 0  ]; then
    if [ -f /etc/init.d/glusterfsd  ]; then
        /sbin/service glusterfsd stop &>/dev/null ;    fi
    /sbin/service glusterd stop &>/dev/null ;    if [ -f /etc/init.d/glusterfsd  ]; then
        /sbin/chkconfig --del glusterfsd ;    fi
    /sbin/chkconfig --del glusterd ;fi
if [ $1 -ge 1  ]; then
    if [ -f /etc/init.d/glusterfsd  ]; then
        /sbin/service glusterfsd condrestart &>/dev/null ;    fi
    /sbin/service glusterd condrestart &>/dev/null ;fi

##-----------------------------------------------------------------------------
## All %postun should be placed here and keep them sorted
##
postuninstall program: /bin/sh