| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# Set processor architecture |
| 6 |
if [ -z $CPU_TARGET ]; then |
| 7 |
export CPU_TARGET=$(fpc -iTP) |
| 8 |
fi |
| 9 |
|
| 10 |
# Determine library directory |
| 11 |
if [[ "$CPU_TARGET" == *"64" ]] && [ ! -f "/etc/debian_version" ] |
| 12 |
then |
| 13 |
LIB_SUFFIX=64 |
| 14 |
else |
| 15 |
LIB_SUFFIX= |
| 16 |
fi |
| 17 |
|
| 18 |
# Parse input parameters |
| 19 |
CKNAME=$(basename "$0") |
| 20 |
args=$(getopt -n $CKNAME -o P:,I: -l portable-prefix:,install-prefix:,default -- "$@") |
| 21 |
eval set -- $args |
| 22 |
for A |
| 23 |
do |
| 24 |
case "$A" in |
| 25 |
--) |
| 26 |
DC_INSTALL_DIR=/usr/lib$LIB_SUFFIX/doublecmd |
| 27 |
;; |
| 28 |
-P|--portable-prefix) |
| 29 |
shift |
| 30 |
CK_PORTABLE=1 |
| 31 |
DC_INSTALL_DIR=$(eval echo $1/doublecmd) |
| 32 |
break |
| 33 |
;; |
| 34 |
-I|--install-prefix) |
| 35 |
shift |
| 36 |
DC_INSTALL_PREFIX=$(eval echo $1) |
| 37 |
DC_INSTALL_DIR=$DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX/doublecmd |
| 38 |
break |
| 39 |
;; |
| 40 |
esac |
| 41 |
shift |
| 42 |
done |
| 43 |
|
| 44 |
mkdir -p $DC_INSTALL_DIR |
| 45 |
|
| 46 |
mkdir -p $DC_INSTALL_DIR/plugins |
| 47 |
# WCX plugins directories |
| 48 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx |
| 49 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/base64 |
| 50 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/cpio |
| 51 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/deb |
| 52 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/rpm |
| 53 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/unrar |
| 54 |
mkdir -p $DC_INSTALL_DIR/plugins/wcx/zip |
| 55 |
# WDX plugins directories |
| 56 |
mkdir -p $DC_INSTALL_DIR/plugins/wdx |
| 57 |
mkdir -p $DC_INSTALL_DIR/plugins/wdx/scripts |
| 58 |
mkdir -p $DC_INSTALL_DIR/plugins/wdx/rpm_wdx |
| 59 |
mkdir -p $DC_INSTALL_DIR/plugins/wdx/deb_wdx |
| 60 |
mkdir -p $DC_INSTALL_DIR/plugins/wdx/audioinfo |
| 61 |
# WFX plugins directories |
| 62 |
mkdir -p $DC_INSTALL_DIR/plugins/wfx |
| 63 |
mkdir -p $DC_INSTALL_DIR/plugins/wfx/ftp |
| 64 |
mkdir -p $DC_INSTALL_DIR/plugins/wfx/samba |
| 65 |
# WLX plugins directories |
| 66 |
mkdir -p $DC_INSTALL_DIR/plugins/wlx |
| 67 |
mkdir -p $DC_INSTALL_DIR/plugins/wlx/wlxmplayer |
| 68 |
# DSX plugins directories |
| 69 |
mkdir -p $DC_INSTALL_DIR/plugins/dsx |
| 70 |
mkdir -p $DC_INSTALL_DIR/plugins/dsx/dsxlocate |
| 71 |
|
| 72 |
# Copy files |
| 73 |
cp -a doublecmd $DC_INSTALL_DIR/ |
| 74 |
cp -a doublecmd.help $DC_INSTALL_DIR/ |
| 75 |
cp -a doublecmd.zdli $DC_INSTALL_DIR/ |
| 76 |
cp -a pinyin.tbl $DC_INSTALL_DIR/ |
| 77 |
|
| 78 |
# Copy default settings |
| 79 |
cp -r default $DC_INSTALL_DIR/ |
| 80 |
|
| 81 |
# copy plugins |
| 82 |
# WCX |
| 83 |
install -m 644 plugins/wcx/base64/base64.wcx $DC_INSTALL_DIR/plugins/wcx/base64/ |
| 84 |
install -m 644 plugins/wcx/cpio/cpio.wcx $DC_INSTALL_DIR/plugins/wcx/cpio/ |
| 85 |
install -m 644 plugins/wcx/deb/deb.wcx $DC_INSTALL_DIR/plugins/wcx/deb/ |
| 86 |
install -m 644 plugins/wcx/rpm/rpm.wcx $DC_INSTALL_DIR/plugins/wcx/rpm/ |
| 87 |
cp -r plugins/wcx/unrar/language $DC_INSTALL_DIR/plugins/wcx/unrar |
| 88 |
install -m 644 plugins/wcx/unrar/unrar.wcx $DC_INSTALL_DIR/plugins/wcx/unrar/ |
| 89 |
cp -r plugins/wcx/zip/language $DC_INSTALL_DIR/plugins/wcx/zip |
| 90 |
install -m 644 plugins/wcx/zip/zip.wcx $DC_INSTALL_DIR/plugins/wcx/zip/ |
| 91 |
# WDX |
| 92 |
install -m 644 plugins/wdx/rpm_wdx/rpm_wdx.wdx $DC_INSTALL_DIR/plugins/wdx/rpm_wdx/ |
| 93 |
install -m 644 plugins/wdx/deb_wdx/deb_wdx.wdx $DC_INSTALL_DIR/plugins/wdx/deb_wdx/ |
| 94 |
install -m 644 plugins/wdx/scripts/* $DC_INSTALL_DIR/plugins/wdx/scripts/ |
| 95 |
install -m 644 plugins/wdx/audioinfo/audioinfo.wdx $DC_INSTALL_DIR/plugins/wdx/audioinfo/ |
| 96 |
install -m 644 plugins/wdx/audioinfo/audioinfo.lng $DC_INSTALL_DIR/plugins/wdx/audioinfo/ |
| 97 |
# WFX |
| 98 |
cp -r plugins/wfx/ftp/language $DC_INSTALL_DIR/plugins/wfx/ftp |
| 99 |
install -m 644 plugins/wfx/ftp/ftp.wfx $DC_INSTALL_DIR/plugins/wfx/ftp/ |
| 100 |
install -m 644 plugins/wfx/ftp/src/ftp.ico $DC_INSTALL_DIR/plugins/wfx/ftp/ |
| 101 |
install -m 644 plugins/wfx/samba/samba.wfx $DC_INSTALL_DIR/plugins/wfx/samba/ |
| 102 |
# WLX |
| 103 |
install -m 644 plugins/wlx/WlxMplayer/wlxmplayer.wlx $DC_INSTALL_DIR/plugins/wlx/wlxmplayer/ |
| 104 |
# DSX |
| 105 |
install -m 644 plugins/dsx/DSXLocate/dsxlocate.dsx $DC_INSTALL_DIR/plugins/dsx/dsxlocate/ |
| 106 |
|
| 107 |
if [ -z $CK_PORTABLE ] |
| 108 |
then |
| 109 |
# Copy libraries |
| 110 |
install -d $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX |
| 111 |
if [ "$(echo *.so*)" != "*.so*" ]; then |
| 112 |
install -m 644 *.so* $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX |
| 113 |
fi |
| 114 |
# Create directory for platform independed files |
| 115 |
install -d $DC_INSTALL_PREFIX/usr/share/doublecmd |
| 116 |
# Copy man files |
| 117 |
install -d -m 755 $DC_INSTALL_PREFIX/usr/share/man/man1 |
| 118 |
install -c -m 644 install/linux/*.1 $DC_INSTALL_PREFIX/usr/share/man/man1 |
| 119 |
# Copy documentation |
| 120 |
install -d $DC_INSTALL_PREFIX/usr/share/doublecmd/doc |
| 121 |
install -m 644 doc/*.txt $DC_INSTALL_PREFIX/usr/share/doublecmd/doc |
| 122 |
ln -sf ../../share/doublecmd/doc $DC_INSTALL_DIR/doc |
| 123 |
# Copy scripts |
| 124 |
install -d $DC_INSTALL_DIR/scripts |
| 125 |
cp -a scripts/*.py $DC_INSTALL_DIR/scripts/ |
| 126 |
# Copy languages |
| 127 |
cp -r language $DC_INSTALL_PREFIX/usr/share/doublecmd |
| 128 |
ln -sf ../../share/doublecmd/language $DC_INSTALL_DIR/language |
| 129 |
# Copy pixmaps |
| 130 |
cp -r pixmaps $DC_INSTALL_PREFIX/usr/share/doublecmd |
| 131 |
ln -sf ../../share/doublecmd/pixmaps $DC_INSTALL_DIR/pixmaps |
| 132 |
# Copy highlighters |
| 133 |
cp -r highlighters $DC_INSTALL_PREFIX/usr/share/doublecmd |
| 134 |
ln -sf ../../share/doublecmd/highlighters $DC_INSTALL_DIR/highlighters |
| 135 |
# Create symlink and desktop files |
| 136 |
install -d $DC_INSTALL_PREFIX/usr/bin |
| 137 |
install -d $DC_INSTALL_PREFIX/usr/share/pixmaps |
| 138 |
install -d $DC_INSTALL_PREFIX/usr/share/applications |
| 139 |
install -d $DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps |
| 140 |
ln -sf ../lib$LIB_SUFFIX/doublecmd/doublecmd $DC_INSTALL_PREFIX/usr/bin/doublecmd |
| 141 |
install -m 644 doublecmd.png $DC_INSTALL_PREFIX/usr/share/pixmaps/doublecmd.png |
| 142 |
install -m 644 install/linux/doublecmd.desktop $DC_INSTALL_PREFIX/usr/share/applications/doublecmd.desktop |
| 143 |
ln -sf ../../../../doublecmd/pixmaps/mainicon/alt/dcfinal.svg \ |
| 144 |
$DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps/doublecmd.svg |
| 145 |
install -d $DC_INSTALL_PREFIX/usr/share/polkit-1/actions |
| 146 |
install -m 644 install/linux/org.doublecmd.root.policy $DC_INSTALL_PREFIX/usr/share/polkit-1/actions/ |
| 147 |
else |
| 148 |
# Make portable version |
| 149 |
mkdir $DC_INSTALL_DIR/settings |
| 150 |
touch $DC_INSTALL_DIR/settings/doublecmd.inf |
| 151 |
# Copy documentation |
| 152 |
mkdir -p $DC_INSTALL_DIR/doc |
| 153 |
cp -a doc/*.txt $DC_INSTALL_DIR/doc/ |
| 154 |
# Copy script for execute portable version |
| 155 |
cp -a doublecmd.sh $DC_INSTALL_DIR/ |
| 156 |
# Copy directories |
| 157 |
cp -r language $DC_INSTALL_DIR/ |
| 158 |
cp -r pixmaps $DC_INSTALL_DIR/ |
| 159 |
cp -r highlighters $DC_INSTALL_DIR/ |
| 160 |
# Copy scripts |
| 161 |
install -d $DC_INSTALL_DIR/scripts |
| 162 |
cp -a scripts/*.py $DC_INSTALL_DIR/scripts/ |
| 163 |
# Copy libraries |
| 164 |
install -m 644 *.so* $DC_INSTALL_DIR/ |
| 165 |
# Copy DC icon |
| 166 |
cp -a doublecmd.png $DC_INSTALL_DIR/doublecmd.png |
| 167 |
fi |