install.sh 6.9 KB

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