install.sh 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. # WDX plugins directories
  50. mkdir -p $DC_INSTALL_DIR/plugins/wdx
  51. mkdir -p $DC_INSTALL_DIR/plugins/wdx/scripts
  52. mkdir -p $DC_INSTALL_DIR/plugins/wdx/rpm_wdx
  53. mkdir -p $DC_INSTALL_DIR/plugins/wdx/deb_wdx
  54. mkdir -p $DC_INSTALL_DIR/plugins/wdx/audioinfo
  55. # WFX plugins directories
  56. mkdir -p $DC_INSTALL_DIR/plugins/wfx
  57. mkdir -p $DC_INSTALL_DIR/plugins/wfx/ftp
  58. mkdir -p $DC_INSTALL_DIR/plugins/wfx/samba
  59. # WLX plugins directories
  60. mkdir -p $DC_INSTALL_DIR/plugins/wlx
  61. mkdir -p $DC_INSTALL_DIR/plugins/wlx/wlxmplayer
  62. # DSX plugins directories
  63. mkdir -p $DC_INSTALL_DIR/plugins/dsx
  64. mkdir -p $DC_INSTALL_DIR/plugins/dsx/dsxlocate
  65. # Copy files
  66. cp -a doublecmd $DC_INSTALL_DIR/
  67. cp -a doublecmd.help $DC_INSTALL_DIR/
  68. cp -a doublecmd.zdli $DC_INSTALL_DIR/
  69. cp -a pinyin.tbl $DC_INSTALL_DIR/
  70. # Copy default settings
  71. cp -r default $DC_INSTALL_DIR/
  72. # copy plugins
  73. # WCX
  74. install -m 644 plugins/wcx/base64/base64.wcx $DC_INSTALL_DIR/plugins/wcx/base64/
  75. install -m 644 plugins/wcx/cpio/cpio.wcx $DC_INSTALL_DIR/plugins/wcx/cpio/
  76. install -m 644 plugins/wcx/deb/deb.wcx $DC_INSTALL_DIR/plugins/wcx/deb/
  77. install -m 644 plugins/wcx/rpm/rpm.wcx $DC_INSTALL_DIR/plugins/wcx/rpm/
  78. cp -r plugins/wcx/unrar/language $DC_INSTALL_DIR/plugins/wcx/unrar
  79. install -m 644 plugins/wcx/unrar/unrar.wcx $DC_INSTALL_DIR/plugins/wcx/unrar/
  80. cp -r plugins/wcx/zip/language $DC_INSTALL_DIR/plugins/wcx/zip
  81. install -m 644 plugins/wcx/zip/zip.wcx $DC_INSTALL_DIR/plugins/wcx/zip/
  82. # WDX
  83. install -m 644 plugins/wdx/rpm_wdx/rpm_wdx.wdx $DC_INSTALL_DIR/plugins/wdx/rpm_wdx/
  84. install -m 644 plugins/wdx/deb_wdx/deb_wdx.wdx $DC_INSTALL_DIR/plugins/wdx/deb_wdx/
  85. install -m 644 plugins/wdx/scripts/* $DC_INSTALL_DIR/plugins/wdx/scripts/
  86. install -m 644 plugins/wdx/audioinfo/audioinfo.wdx $DC_INSTALL_DIR/plugins/wdx/audioinfo/
  87. install -m 644 plugins/wdx/audioinfo/audioinfo.lng $DC_INSTALL_DIR/plugins/wdx/audioinfo/
  88. # WFX
  89. cp -r plugins/wfx/ftp/language $DC_INSTALL_DIR/plugins/wfx/ftp
  90. install -m 644 plugins/wfx/ftp/ftp.wfx $DC_INSTALL_DIR/plugins/wfx/ftp/
  91. install -m 644 plugins/wfx/ftp/src/ftp.ico $DC_INSTALL_DIR/plugins/wfx/ftp/
  92. install -m 644 plugins/wfx/samba/samba.wfx $DC_INSTALL_DIR/plugins/wfx/samba/
  93. # WLX
  94. install -m 644 plugins/wlx/WlxMplayer/wlxmplayer.wlx $DC_INSTALL_DIR/plugins/wlx/wlxmplayer/
  95. # DSX
  96. install -m 644 plugins/dsx/DSXLocate/dsxlocate.dsx $DC_INSTALL_DIR/plugins/dsx/dsxlocate/
  97. if [ -z $CK_PORTABLE ]
  98. then
  99. # Copy libraries
  100. install -d $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX
  101. if [ "$(echo *.so*)" != "*.so*" ]; then
  102. install -m 644 *.so* $DC_INSTALL_PREFIX/usr/lib$LIB_SUFFIX
  103. fi
  104. # Create directory for platform independed files
  105. install -d $DC_INSTALL_PREFIX/usr/share/doublecmd
  106. # Copy man files
  107. install -d -m 755 $DC_INSTALL_PREFIX/usr/share/man/man1
  108. install -c -m 644 install/linux/*.1 $DC_INSTALL_PREFIX/usr/share/man/man1
  109. # Copy documentation
  110. install -d $DC_INSTALL_PREFIX/usr/share/doublecmd/doc
  111. install -m 644 doc/*.txt $DC_INSTALL_PREFIX/usr/share/doublecmd/doc
  112. ln -sf ../../share/doublecmd/doc $DC_INSTALL_DIR/doc
  113. # Copy scripts
  114. install -d $DC_INSTALL_DIR/scripts
  115. cp -a scripts/*.py $DC_INSTALL_DIR/scripts/
  116. # Copy languages
  117. cp -r language $DC_INSTALL_PREFIX/usr/share/doublecmd
  118. ln -sf ../../share/doublecmd/language $DC_INSTALL_DIR/language
  119. # Copy pixmaps
  120. cp -r pixmaps $DC_INSTALL_PREFIX/usr/share/doublecmd
  121. ln -sf ../../share/doublecmd/pixmaps $DC_INSTALL_DIR/pixmaps
  122. # Copy highlighters
  123. cp -r highlighters $DC_INSTALL_PREFIX/usr/share/doublecmd
  124. ln -sf ../../share/doublecmd/highlighters $DC_INSTALL_DIR/highlighters
  125. # Create symlink and desktop files
  126. install -d $DC_INSTALL_PREFIX/usr/bin
  127. install -d $DC_INSTALL_PREFIX/usr/share/pixmaps
  128. install -d $DC_INSTALL_PREFIX/usr/share/applications
  129. install -d $DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps
  130. ln -sf ../lib$LIB_SUFFIX/doublecmd/doublecmd $DC_INSTALL_PREFIX/usr/bin/doublecmd
  131. install -m 644 doublecmd.png $DC_INSTALL_PREFIX/usr/share/pixmaps/doublecmd.png
  132. install -m 644 install/linux/doublecmd.desktop $DC_INSTALL_PREFIX/usr/share/applications/doublecmd.desktop
  133. ln -sf ../../../../doublecmd/pixmaps/mainicon/alt/dcfinal.svg \
  134. $DC_INSTALL_PREFIX/usr/share/icons/hicolor/scalable/apps/doublecmd.svg
  135. install -d $DC_INSTALL_PREFIX/usr/share/polkit-1/actions
  136. install -m 644 install/linux/org.doublecmd.root.policy $DC_INSTALL_PREFIX/usr/share/polkit-1/actions/
  137. else
  138. # Make portable version
  139. mkdir $DC_INSTALL_DIR/settings
  140. touch $DC_INSTALL_DIR/settings/doublecmd.inf
  141. # Copy documentation
  142. mkdir -p $DC_INSTALL_DIR/doc
  143. cp -a doc/*.txt $DC_INSTALL_DIR/doc/
  144. # Copy script for execute portable version
  145. cp -a doublecmd.sh $DC_INSTALL_DIR/
  146. # Copy directories
  147. cp -r language $DC_INSTALL_DIR/
  148. cp -r pixmaps $DC_INSTALL_DIR/
  149. cp -r highlighters $DC_INSTALL_DIR/
  150. # Copy scripts
  151. install -d $DC_INSTALL_DIR/scripts
  152. cp -a scripts/*.py $DC_INSTALL_DIR/scripts/
  153. # Copy libraries
  154. install -m 644 *.so* $DC_INSTALL_DIR/
  155. # Copy DC icon
  156. cp -a doublecmd.png $DC_INSTALL_DIR/doublecmd.png
  157. fi