On Wed, 3 Dec 2025 11:34:01 +0000 (UTC)
matthew patton wrote:
> the libopenconsole.postinstall script ihas some glaring issues.
> 
> * define strings once and then use the variable instead of repeating over and 
> over and over the long-ass path names.
> 
> * the wget to STDOUT strikes me as pointless. use curl if you're going to 
> resort to that kind of operation. Otherwise just save the .zip to disk 
> already without gratuitous memory buffering
> 
> * /tmp should not be assumed. use $TMPDIR
> 
> * use trap to clean up after yourself in both the successful and unsuccessful 
> cases
> 
> * 'POSTFIX' makes no sense. it's ARCH or PLATFORM
> 
> * personally I would have versions.txt be a tab deliminted file with 
> version_num\tsha256 of x64\tsha256 of x86 or something along those lines.

Thanks!

-- 
Takashi Yano <[email protected]>
if [ $(uname -m) = "x86_64" ]
then
        ARCH="x64"
else
        ARCH="x86"
fi
VERSION=$(cat /etc/libopenconsole/version.txt)
WT_BASENAME=Microsoft.WindowsTerminal_${VERSION}_${ARCH}
TARGET=OpenConsole.exe

trap -- 'rm -f ${WT_BASENAME}.{tmp,zip}' EXIT

cd ${TMPDIR:-/tmp}
wget -q 
https://github.com/microsoft/terminal/releases/download/v${VERSION}/${WT_BASENAME}.zip
 -O ${WT_BASENAME}.tmp
if sha256sum --status -c /etc/libopenconsole/${WT_BASENAME}.zip.sha256
then
        mv ${WT_BASENAME}.tmp ${WT_BASENAME}.zip
        unzip -jq ${WT_BASENAME}.zip "*/${TARGET}"
        chmod 755 ${TARGET}
        mv ${TARGET} /usr/bin/.
else
        # Hash mismatch (or failed to download)
        exit 1
fi
-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to