about summary refs log tree commit diff stats
path: root/commands/global.go
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-09-05 23:32:36 +0100
committerDrew DeVault <sir@cmpwn.com>2019-09-11 11:41:34 -0400
commitf6216bb6213a15cdcdf50089f3c4a8e9a30d9337 (patch)
tree3075b68379ae7c13cb9eedc53b7cf033672478a9 /commands/global.go
parenta441e3b3a55d11e7cc9444298051ff339d1b7519 (diff)
downloadaerc-f6216bb6213a15cdcdf50089f3c4a8e9a30d9337.tar.gz
Add Mouseable
This adds the Mouseable interface. When this is implemented for a
component that item can accept and process mouseevents.

At the top level when a mouse event is received it is passed to the
grid's handler and then it trickles down until it reaches a component
that can actually handle it, such as the tablist, dirlist or msglist.

A mouse event is passed so that components can handle other things such
as scrolling with the mousewheel. The components themselves then perform
the necessary actions.

Clicking emails in the messagelist opens them in a new tab.

Textinputs can be clicked to position the cursor inside them.

Mouseevents are not forwarded to the terminal at the moment.

Elements which do not handle mouse events are not required to implement
the Mouseable interface.
Diffstat (limited to 'commands/global.go')
0 files changed, 0 insertions, 0 deletions
k/doc/blame/core/scripts/backup-system.sh?id=bdea1c23d13c417a00b71654670aed309cfa302a'>^
ef1f1f6 ^
6eacde7 ^
ef1f1f6 ^
6eacde7 ^
ef1f1f6 ^


6eacde7 ^
ef1f1f6 ^

6eacde7 ^
ef1f1f6 ^











6eacde7 ^
ef1f1f6 ^

ef1f1f6 ^


ef1f1f6 ^

593fc59 ^

ef1f1f6 ^



593fc59 ^








94e429f ^
593fc59 ^





ef1f1f6 ^
4cc6765 ^
ef1f1f6 ^

















4cc6765 ^
ef1f1f6 ^




4cc6765 ^

ef1f1f6 ^
4cc6765 ^
ef1f1f6 ^






593fc59 ^
ef1f1f6 ^



593fc59 ^

ef1f1f6 ^
593fc59 ^
ef1f1f6 ^
593fc59 ^
ef1f1f6 ^






593fc59 ^


ef1f1f6 ^
























bdea1c2 ^

ef1f1f6 ^





593fc59 ^
bdea1c2 ^








4cc6765 ^
bdea1c2 ^






4cc6765 ^
bdea1c2 ^





























593fc59 ^
4cc6765 ^
593fc59 ^


ef1f1f6 ^

4cc6765 ^
ef1f1f6 ^
593fc59 ^
ef1f1f6 ^
4cc6765 ^
bdea1c2 ^
















6eacde7 ^
bdea1c2 ^




































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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292








                            
 
















                                                      
 
                 
                                           
          
                                      
                            
                                             
                       
                                                    


                                                     
                                            

          
                                                     











                                                              
                             

          


                                                

 

                 



                                                








                                                                                                                          
 





                                                                                                                                                                                                                                        
                 
 

















                                                                        
              




                                                                      

 
                  
 






                                                               
 



                                                        

 
                     
 
                                  
 






                                                      


         
























                                                                  

                                                      





                                                                      
 








                               
 






                                                                            
 





























                                                   
             
 


                    

                    
 
                   
             
             
 
















                                                              
                                                                         




































                                                            
#!/bin/bash

ROOT_DIR=
DEST_DIR=/root/backup
PORT_PKG="${DEST_DIR}/crux"
PORT_PRT="${DEST_DIR}/ports"
DATA_CNF="${DEST_DIR}/conf"
DATA_USR="${DEST_DIR}/user"
DATA_SRV="${DEST_DIR}/srv"

ConfirmOrExit ()
{
    while true
    do
        echo -n "Please confirm (y or n) :"
        read CONFIRM
        case $CONFIRM in
            y|Y|YES|yes|Yes) break ;;
            n|N|no|NO|No)
                echo "Aborting - you entered $CONFIRM"
                exit
                ;;
            *) echo "Please enter only y or n"
        esac
    done
    echo "You entered $CONFIRM. Continuing ..."
}

mkbk_coll_pkg() {
    # backup binary packages per collection
    col=$1
    # make backup collection directory
    mkdir ${PORT_PKG}/${col}
    # for each package listed in col_name.pkg
    while read line; do
        # if binary package don't exist try to build
        if [ ! -f /usr/ports/packages/${line} ]; then
            echo "Building package: ${line};\n"
            name=$(echo ${line} | cut -d "#" -f 1)
            $sudo prt-get update -fr ${name}
        fi

        # if binary package exist copy to destination
        if [ -f /usr/ports/packages/${line} ]; then
            echo "Backing up package: ${line}"
            echo ${line} >> ${DEST_DIR}/backup.pkg
            cp /usr/ports/packages/${line} ${PORT_PKG}/${col}/
        else
            echo "Package not found: ${line}"
            echo ${line} >> ${DEST_DIR}/${col}-notfound.pkg
        fi
    done < $DEST_DIR/${col}.pkg
}

mkbk_coll_ports() {
    # backup collection ports
    col=$1

    tar --xattrs -zcpf $PORT_PRT/${col}.tar.gz \
        --directory=$ROOT_DIR/usr/ports/${col} \
        --exclude=.git/ \
}

mkbk_metadata() {

    # archive pkgutils data
    tar --xattrs -zcpf $DATA_CNF/pkg-db.tar.gz \
        /var/lib/pkg/db

    # must be using gwak instead of sed, xargs and echo
    prt-get listinst -v | sed -s s/" "/#/g | xargs -i echo {}.pkg.tar.gz > ${DEST_DIR}/installed.pkg

    # make list and copy installed core packages
    prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep "yes /usr/ports/core" | cut -d " " -f 3 > ${DEST_DIR}/core.pkg

    prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep "yes /usr/ports/opt" | cut -d " " -f 3 > $DEST_DIR/opt.pkg

    prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep "yes /usr/ports/contrib" | cut -d " " -f 3 > $DEST_DIR/contrib.pkg

    prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep "yes /usr/ports/xorg" | cut -d " " -f 3 > $DEST_DIR/xorg.pkg

    prt-get printf "%i %p %n#%v-%r.pkg.tar.gz\n" | grep -v "yes /usr/ports/core" | grep -v "yes /usr/ports/opt" | grep -v "yes /usr/ports/contrib" | grep -v "yes /usr/ports/xorg" | grep "yes " | cut -d " " -f 3 > $DEST_DIR/other.pkg

}

mkbk_etc_conf() {

    tar --xattrs -zcpf $DATA_CNF/etc.tar.gz \
        --directory=$ROOT_DIR/etc \
        .

    tar --xattrs -zcpf $DATA_CNF/usr_etc.tar.gz \
        --directory=$ROOT_DIR/usr/etc \
        .
}

mkbk_srv_www() {

    # backup web data first stop php and nginx

    for pkg_www in ${ROOT_DIR}/srv/www/*; do
        if [[ ! $(ls ${pkg_www} | grep -v "backup_deploy") = "" ]]; then
            pkg_back="${DATA_SRV}/www"
            if [ ! -d ${pkg_back} ]; then
                mkdir -p ${pkg_back}
            fi
            bck_file="${pkg_back}/$(basename ${pkg_www}).tar.gz"
            exc="${pkg_www}/backup_deploy"
            tar --exclude ${exc} --xattrs -zcpf ${bck_file} ${pkg_www}
        fi
    done
}

mkbk_srv_pgsql() {

    # backup database data first dump all databases

    pkg_back="${DATA_SRV}/pgsql"
    if [ ! -d ${pkg_back} ]; then
        mkdir -p ${pkg_back}
    fi
    pg_dumpall -U postgres | gzip > ${pkg_back}/cluster_dump.gz

    tar --xattrs -zcpf "${pkg_back}/pgsql-conf.tar.gz" \
        ${ROOT_DIR}/srv/pgsql/data/pg_hba.conf \
        ${ROOT_DIR}/srv/pgsql/data/pg_ident.conf \
        ${ROOT_DIR}/srv/pgsql/data/postgresql.conf
}

mkbk_srv_gitolite() {

    # backup gitolite repositories

    pkg_back="${DATA_SRV}/gitolite"
    if [ ! -d ${pkg_back} ]; then
        mkdir -p ${pkg_back}
    fi

    tar --xattrs -zcpf "${pkg_back}/gitolite.tar.gz" \
        --directory=${ROOT_DIR}/srv/gitolite \
        .
}

mkbk_user_metadata() {

    for dir in /home/*; do
        if [ "${dir}" != "/home/lost+found" ]; then
            user=$(basename $dir)
            tar --xattrs -zcpf "${DATA_USR}/meta-${user}.tar.gz" \
                $dir/.bash_profile \
                $dir/.bashrc \
                $dir/.config \
                $dir/.gitconfig \
                $dir/.gnupg \
                $dir/.irssi \
                $dir/.lynxrc \
                $dir/.mutt \
                $dir/.netrc \
                $dir/.profile \
                $dir/.spectrwm.conf \
                $dir/.ssh \
                $dir/.tmux.conf \
                $dir/.vim \
                $dir/.vimrc \
                $dir/.xinitrc

            # encript data
            #gpg --output "${DATA_USR}/meta-${user}.tar.gz.gpg" \
                #    --encrypt --recipient user@host \
                #    "${DATA_USR}/meta-${user}.tar.gz"

            tar --xattrs -zcpf "${DATA_USR}/gitolite-${user}.tar.gz" \
                $dir/gitolite-admin
        fi
    done
}

print_data () {
    echo "ROOT_DIR=${ROOT_DIR}"
    echo "DEST_DIR=${DEST_DIR}"
    echo "PORT_PKG=${PORT_PKG}"
    echo "PORT_PRT=${PORT_PRT}"
    echo "DATA_CNF=${DATA_CNF}"
    echo "DATA_USR=${DATA_USR}"
    echo "DATA_SRV=${DATA_SRV}"
}

print_help() {
    echo "usage: backup-system [options]"
    echo "options:"
    echo "  -r,   --root                root directory to backup, default /"
    echo "  -d,   --destination         save backup, default /root/backup"
    echo "  -h,   --help                print help and exit"
}

while [ "$1" ]; do
    case $1 in
        -r|--root)
            ROOT_DIR=$2
            if [ ${ROOT_DIR} == "/" ]; then
                ROOT_DIR=""
            fi
            shift ;;
        -d|--destination)
            DEST_DIR=$2

            # Destination directory
            PORT_PKG="${DEST_DIR}/crux"
            PORT_PRT="${DEST_DIR}/ports"
            DATA_CNF="${DEST_DIR}/conf"
            DATA_USR="${DEST_DIR}/user"
            DATA_SRV="${DEST_DIR}/srv"
            shift ;;
        -h|--help)
            print_help
            exit 0 ;;
        *)
            echo "backup-system: invalid option $1"
            print_help
            exit 1 ;;
    esac
    shift
done

print_data
ConfirmOrExit

mkdir -p ${PORT_PKG}
mkdir -p ${PORT_PRT}
mkdir -p ${DATA_CNF}
mkdir -p ${DATA_USR}
mkdir -p ${DATA_SRV}

# Light backup data
mkbk_metadata
mkbk_etc_conf

while true
do
    echo -n "Backup user metadata ? Please confirm (y or n) :"
    read CONFIRM
    case $CONFIRM in
        n|N|no|NO|No) break ;;
        y|Y|YES|yes|Yes)
            echo "Accept - you entered $CONFIRM"
            mkbk_user_metadata
            break
            ;;
        *) echo "Please enter only y or n"
    esac
done

while true
do
    echo -n "Backup web services data (/srv) ? Please confirm (y or n) :"
    read CONFIRM
    case $CONFIRM in
        n|N|no|NO|No) break ;;
        y|Y|YES|yes|Yes)
            echo "Accept - you entered $CONFIRM"
            mkbk_srv_www
            mkbk_srv_pgsql
            mkbk_srv_gitolite
            break
            ;;
        *) echo "Please enter only y or n"
    esac
done


while true
do
    echo -n "Backup port system ? Please confirm (y or n) :"
    read CONFIRM
    case $CONFIRM in
        n|N|no|NO|No) break ;;
        y|Y|YES|yes|Yes)
            echo "Accept - you entered $CONFIRM"
            mkbk_coll_ports "core"
            mkbk_coll_pkg "core"
            mkbk_coll_ports "opt"
            mkbk_coll_pkg "opt"
            mkbk_coll_ports "contrib"
            mkbk_coll_pkg "contrib"
            mkbk_coll_ports "xorg"
            mkbk_coll_pkg "xorg"
            mkbk_coll_pkg "other"
            break
            ;;
        *) echo "Please enter only y or n"
    esac
done