File: install.sh

package info (click to toggle)
doublecmd 1.1.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 43,968 kB
  • sloc: pascal: 374,335; sh: 1,180; ansic: 724; makefile: 132; python: 52; xml: 16
file content (167 lines) | stat: -rwxr-xr-x 6,812 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

set -e

# Set processor architecture
if [ -z $CPU_TARGET ]; then
   export CPU_TARGET=$(fpc -iTP)
fi

# Determine library directory
if [[ "$CPU_TARGET" == *"64" ]] && [ ! -f "/etc/debian_version" ]
   then
       LIB_SUFFIX=64
   else
       LIB_SUFFIX=
fi

# Parse input parameters
CKNAME=$(basename "$0")
args=$(getopt -n $CKNAME -o P:,I: -l portable-prefix:,install-prefix:,default -- "$@")
eval set -- $args
for A
do
  case "$A" in
       --)
            DC_INSTALL_DIR=/usr/lib$LIB_SUFFIX/doublecmd
            ;;
        -P|--portable-prefix)
            shift
            CK_PORTABLE=1
            DC_INSTALL_DIR=$(eval echo $1/doublecmd)
            break
            ;;
        -I|--install-prefix)
            shift
            DC_INSTALL_PREFIX=$(eval echo $1)
            DC_INSTALL_DIR=$DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX/doublecmd
            break
            ;;
  esac
  shift
done

mkdir -p $DC_INSTALL_DIR

mkdir -p $DC_INSTALL_DIR/plugins
# WCX plugins directories
mkdir -p $DC_INSTALL_DIR/plugins/wcx
mkdir -p $DC_INSTALL_DIR/plugins/wcx/base64
mkdir -p $DC_INSTALL_DIR/plugins/wcx/cpio
mkdir -p $DC_INSTALL_DIR/plugins/wcx/deb
mkdir -p $DC_INSTALL_DIR/plugins/wcx/rpm
mkdir -p $DC_INSTALL_DIR/plugins/wcx/unrar
mkdir -p $DC_INSTALL_DIR/plugins/wcx/zip
# WDX plugins directories
mkdir -p $DC_INSTALL_DIR/plugins/wdx
mkdir -p $DC_INSTALL_DIR/plugins/wdx/scripts
mkdir -p $DC_INSTALL_DIR/plugins/wdx/rpm_wdx
mkdir -p $DC_INSTALL_DIR/plugins/wdx/deb_wdx
mkdir -p $DC_INSTALL_DIR/plugins/wdx/audioinfo
# WFX plugins directories
mkdir -p $DC_INSTALL_DIR/plugins/wfx
mkdir -p $DC_INSTALL_DIR/plugins/wfx/ftp
mkdir -p $DC_INSTALL_DIR/plugins/wfx/samba
# WLX plugins directories
mkdir -p $DC_INSTALL_DIR/plugins/wlx
mkdir -p $DC_INSTALL_DIR/plugins/wlx/wlxmplayer
# DSX plugins directories
mkdir -p $DC_INSTALL_DIR/plugins/dsx
mkdir -p $DC_INSTALL_DIR/plugins/dsx/dsxlocate

# Copy files
cp -a doublecmd                    $DC_INSTALL_DIR/
cp -a doublecmd.help               $DC_INSTALL_DIR/
cp -a doublecmd.zdli               $DC_INSTALL_DIR/
cp -a pinyin.tbl                   $DC_INSTALL_DIR/

# Copy default settings
cp -r default                      $DC_INSTALL_DIR/

# copy plugins
# WCX
install -m 644 plugins/wcx/base64/base64.wcx        $DC_INSTALL_DIR/plugins/wcx/base64/
install -m 644 plugins/wcx/cpio/cpio.wcx            $DC_INSTALL_DIR/plugins/wcx/cpio/
install -m 644 plugins/wcx/deb/deb.wcx              $DC_INSTALL_DIR/plugins/wcx/deb/
install -m 644 plugins/wcx/rpm/rpm.wcx              $DC_INSTALL_DIR/plugins/wcx/rpm/
cp -r plugins/wcx/unrar/language                    $DC_INSTALL_DIR/plugins/wcx/unrar
install -m 644 plugins/wcx/unrar/unrar.wcx          $DC_INSTALL_DIR/plugins/wcx/unrar/
cp -r plugins/wcx/zip/language                      $DC_INSTALL_DIR/plugins/wcx/zip
install -m 644 plugins/wcx/zip/zip.wcx              $DC_INSTALL_DIR/plugins/wcx/zip/
# WDX
install -m 644 plugins/wdx/rpm_wdx/rpm_wdx.wdx      $DC_INSTALL_DIR/plugins/wdx/rpm_wdx/
install -m 644 plugins/wdx/deb_wdx/deb_wdx.wdx      $DC_INSTALL_DIR/plugins/wdx/deb_wdx/
install -m 644 plugins/wdx/scripts/*                $DC_INSTALL_DIR/plugins/wdx/scripts/
install -m 644 plugins/wdx/audioinfo/audioinfo.wdx  $DC_INSTALL_DIR/plugins/wdx/audioinfo/
install -m 644 plugins/wdx/audioinfo/audioinfo.lng  $DC_INSTALL_DIR/plugins/wdx/audioinfo/
# WFX
cp -r plugins/wfx/ftp/language                      $DC_INSTALL_DIR/plugins/wfx/ftp
install -m 644 plugins/wfx/ftp/ftp.wfx              $DC_INSTALL_DIR/plugins/wfx/ftp/
install -m 644 plugins/wfx/ftp/src/ftp.ico          $DC_INSTALL_DIR/plugins/wfx/ftp/
install -m 644 plugins/wfx/samba/samba.wfx          $DC_INSTALL_DIR/plugins/wfx/samba/
# WLX
install -m 644 plugins/wlx/WlxMplayer/wlxmplayer.wlx  $DC_INSTALL_DIR/plugins/wlx/wlxmplayer/
# DSX
install -m 644 plugins/dsx/DSXLocate/dsxlocate.dsx    $DC_INSTALL_DIR/plugins/dsx/dsxlocate/

if [ -z $CK_PORTABLE ]
  then
    # Copy libraries
    install -d                $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX
    if [ "$(echo *.so*)" != "*.so*" ]; then
      install -m 644 *.so*    $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX
    fi
    # Create directory for platform independed files
    install -d                $DC_INSTALL_PREFIX/usr/share/doublecmd
    # Copy man files
    install -d -m 755                      $DC_INSTALL_PREFIX/usr/share/man/man1
    install -c -m 644 install/linux/*.1    $DC_INSTALL_PREFIX/usr/share/man/man1
    # Copy documentation
    install -d                $DC_INSTALL_PREFIX/usr/share/doublecmd/doc
    install -m 644 doc/*.txt  $DC_INSTALL_PREFIX/usr/share/doublecmd/doc
    ln -sf ../../share/doublecmd/doc $DC_INSTALL_DIR/doc
    # Copy scripts
    install -d         $DC_INSTALL_DIR/scripts
    cp -a scripts/*.py $DC_INSTALL_DIR/scripts/
    # Copy languages
    cp -r language $DC_INSTALL_PREFIX/usr/share/doublecmd
    ln -sf ../../share/doublecmd/language $DC_INSTALL_DIR/language
    # Copy pixmaps
    cp -r pixmaps $DC_INSTALL_PREFIX/usr/share/doublecmd
    ln -sf ../../share/doublecmd/pixmaps $DC_INSTALL_DIR/pixmaps
    # Copy highlighters
    cp -r highlighters $DC_INSTALL_PREFIX/usr/share/doublecmd
    ln -sf ../../share/doublecmd/highlighters $DC_INSTALL_DIR/highlighters
    # Create symlink and desktop files
    install -d $DC_INSTALL_PREFIX/usr/bin
    install -d $DC_INSTALL_PREFIX/usr/share/pixmaps
    install -d $DC_INSTALL_PREFIX/usr/share/applications
    install -d $DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps
    ln -sf  ../lib$LIB_SUFFIX/doublecmd/doublecmd $DC_INSTALL_PREFIX/usr/bin/doublecmd
    install -m 644 doublecmd.png $DC_INSTALL_PREFIX/usr/share/pixmaps/doublecmd.png
    install -m 644 install/linux/doublecmd.desktop $DC_INSTALL_PREFIX/usr/share/applications/doublecmd.desktop
    ln -sf ../../../../doublecmd/pixmaps/mainicon/alt/dcfinal.svg \
           $DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps/doublecmd.svg
    install -d $DC_INSTALL_PREFIX/usr/share/polkit-1/actions
    install -m 644 install/linux/org.doublecmd.root.policy $DC_INSTALL_PREFIX/usr/share/polkit-1/actions/
  else
    # Make portable version
    mkdir $DC_INSTALL_DIR/settings
    touch $DC_INSTALL_DIR/settings/doublecmd.inf
    # Copy documentation
    mkdir -p $DC_INSTALL_DIR/doc
    cp -a doc/*.txt $DC_INSTALL_DIR/doc/
    # Copy script for execute portable version
    cp -a doublecmd.sh $DC_INSTALL_DIR/
    # Copy directories
    cp -r language     $DC_INSTALL_DIR/
    cp -r pixmaps      $DC_INSTALL_DIR/
    cp -r highlighters $DC_INSTALL_DIR/
    # Copy scripts
    install -d         $DC_INSTALL_DIR/scripts
    cp -a scripts/*.py $DC_INSTALL_DIR/scripts/
    # Copy libraries
    install -m 644 *.so*    $DC_INSTALL_DIR/
    # Copy DC icon
    cp -a doublecmd.png     $DC_INSTALL_DIR/doublecmd.png
fi