summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1741916569b11204cb4f6620588fcd2a84c9dd7b (plain)
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
# Maintainer:  Chris Severance aur.severach aATt spamgourmet dott com

# 1 for RAID
# 0 for non RAID (smaller)
_opt_RAID=0

set -u
pkgname='seagate-seachest'
# Version is numbered according to Basics, formerly the firmware upgrader
# The package version is the second set of numbers #_#_#, not the first #.#.#.
_pkgver='3.6.2-8_0_1'
pkgver="${_pkgver//-/.}"
pkgrel=1
pkgdesc='Seagate SeaChest suite including Basics Configure (sctReadTimer,TLER,writecache) Erase (secure,trim) Firmware (update) Format (setSectorSize) GenericTests Info Lite PowerControl SMART Security, formerly seaflashlin'
arch=('x86_64')
url='https://www.seagate.com/support/software/seachest/'
#url='https://github.com/Seagate/ToolBin/tree/master/SeaChest'
#url='https://github.com/Seagate/openSeaChest'
license=('custom')
depends=('gcc-libs')
#depends+=('ncurses5-compat-libs') # no longer as of version 3
#if [ "${_opt_RAID}" -ne 0 ]; then
#  makedepends=('unzip')
#fi
options=('!strip')
source=("SeaChestUtilities_${_pkgver}.zip::https://www.seagate.com/content/dam/seagate/migrated-assets/old-support-files/seachest/SeaChestUtilities.zip") # Linux is contained within the Windows download
_srcdir='SeaChestUtilities/SeaChestUtilities'
md5sums=('48272f33765bc77280a8eb1d045b1609')
sha256sums=('c1408ebd0abf67a83691bc7326a7dea82d4c664902a361406f629d2177e4bcbc')

pkgver_disabled() {
  sed -E -n -e 's/^ SeaChest_Basics Version: ([^ ]+).*$/\1/p' 'SeaChest_Combo_UserGuides.txt' | sed -e 's:-:.:'
}

prepare() {
  set -u
  cd "${_srcdir}"
  grep -Fe ' Version:' 'SeaChest_Combo_UserGuides.txt'
  #grep -Fe ' Version:' 'SeaChest_Combo_UserGuides.txt' > "${startdir}/SeaChest.Version.${pkgver}.txt"
  #chmod -R 755 'Linux/Lin64'
  local _newver
  _newver="$(sed -E -n -e 's/^ SeaChest_Basics Version: ([^ ]+).*$/\1/p' 'SeaChest_Combo_UserGuides.txt' | sed -e 's:-:.:')"
  if [ "${pkgver}" != "${_newver}" ]; then
    echo "New Version ${_newver}"
    set +u
    exit 1
  fi
  set +u
}

package() {
  set -u
  cd "${_srcdir}"
  install -Dpm644 'About.SeaChest.txt' -t "${pkgdir}/usr/share/licenses/${pkgname}"
  local _trim
  if [ "${_opt_RAID}" -eq 0 ]; then
    case "${CARCH}" in
    x86_64) pushd $(find -type 'd' -name 'x86_64') > /dev/null; _trim='_x86_64-';;
    *arm*) pushd $(find -type 'd' -name 'aarch64') > /dev/null; _trim='_aarch64-';;
    esac
    for _f in SeaChest*; do
      install -Dpm744 "${_f}" "${pkgdir}/usr/bin/${_f%%${_trim}*}"
    done
  else
    case "${CARCH}" in
    x86_64) pushd $(find -type 'd' -name 'x86_64-RAID') > /dev/null; _trim='_x86_64-';;
    *arm*) pushd $(find -type 'd' -name 'aarch64_RAID') > /dev/null; _trim='_aarch64-';;
    esac
    install -d "${pkgdir}/tmp"
    local _f _fx
    for _f in SeaChest*.zip; do
      #unzip -q -o -d "${pkgdir}/tmp" "${_f}"
      bsdtar -C "${pkgdir}/tmp" -xf "${_f}"
    done
    pushd "${pkgdir}/tmp" > /dev/null
    for _f in SeaChest*; do
      #unzip -q -P 'I-have-read-and-accept-the-Seagate-and-Broadcom-Licenses' "${_f}"
      bsdtar --passphrase 'I-have-read-and-accept-the-Seagate-and-Broadcom-Licenses' -xf "${_f}"
    done
    install -Dpm644 *.txt *.pdf -t "${pkgdir}/usr/share/licenses/${pkgname}"
    for _f in SeaChest*/SeaChest*; do
      install -Dpm744 "${_f}" "${pkgdir}/usr/bin/${_f%%${_trim}*}"
    done
    popd > /dev/null
    rm -rf "${pkgdir}/tmp"
  fi
  popd > /dev/null
  install -d "${pkgdir}/usr/share/doc"
  mv 'doc' "${pkgdir}/usr/share/doc/${pkgname}"
  mv 'SeaChest_Combo_UserGuides.txt' "${pkgdir}/usr/share/doc/${pkgname}"
  #install -d "${pkgdir}/usr/share"
  #mv 'man' "${pkgdir}/usr/share"
  set +u
}
set +u