1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p python3 pup curl jq nix
5 echoerr
() { echo "$@" 1>&2; }
8 echoerr got fname
$fname
12 # See comment near version_major variable
13 if [[ $variant == fresh
]]; then
15 elif [[ $variant == still
]]; then
18 echoerr got unknown variant
$variant
21 echoerr got variant
$variant
24 # Not totally needed, but makes it easy to run the update in case tis folder is
26 mkdir
-p "$(dirname $fname)/src-$variant"
27 cd "$(dirname $fname)/src-$variant"
29 # The pup command prints both fresh and still versions one after another, and
30 # we use either head -1 or tail -1 to get the right version, per the if elif
32 version_major
="$(curl --silent https://www.libreoffice.org/download/download-libreoffice/ |\
33 pup '.dl_version_number text{}' | $head_tail -1)"
34 echoerr got from website
${variant}_version
$version_major
35 baseurl
=https
://download.documentfoundation.org
/libreoffice
/src
/$version_major
36 tarballs
=($
(curl
--silent $baseurl/ |\
38 jq
--raw-output '.. | .href? | strings' |\
39 grep "$version_major.*.tar.xz$"))
41 full_version
="$(echo ${tarballs[0]} | sed -e 's/^libreoffice-//' -e 's/.tar.xz$//')"
42 echoerr full version is
$full_version
43 echo \"$full_version\" > version.nix
45 for t
in help translations
; do
47 echo " sha256 = "\"$
(nix-prefetch-url
$baseurl/libreoffice-
$t-$full_version.
tar.xz
)'";' >> $t.nix
48 echo " url = "\"$baseurl/libreoffice-
$t-$full_version.
tar.xz
'";' >> $t.nix
52 # Out of loop nix-prefetch-url, because there is no $t, and we want the output
53 # path as well, to get the download.lst file from there afterwards.
54 main_path_hash
=($
(nix-prefetch-url
--print-path $baseurl/libreoffice-
$full_version.
tar.xz
))
56 echo " sha256 = "\"${main_path_hash[0]}'";' >> main.nix
57 echo " url = "\"$baseurl/libreoffice-
$full_version.
tar.xz
'";' >> main.nix
59 echoerr got filename
${main_path_hash[1]}
61 # Environment variable required by ../generate-libreoffice-srcs.py
62 export downloadList
=/tmp
/nixpkgs-libreoffice-update-download-
$full_version.lst
63 # Need to extract the file only if it doesn't exist, otherwise spare time be
65 if [[ ! -f "$downloadList" ]]; then
67 --file=${main_path_hash[1]} \
68 libreoffice-
$full_version/download.lst \
71 echoerr relying on previously downloaded downloadList
file
74 python3 .
/generate-libreoffice-srcs.py
> src-
$variant/deps.nix