Skip to content

Commit

Permalink
Version 1.1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbojko committed Dec 2, 2024
1 parent 01877d6 commit d173e73
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
*.vscode/*
*.nupkg
.snippets/*

121 changes: 121 additions & 0 deletions .snippets/replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/usr/bin/env bash
# ANSI color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

echo -e "${GREEN}Determining operating system...${NC}"
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
machine="Linux"
grep_command="grep"
sed_binary="sed"
;;
Darwin*)
machine="Mac"
grep_command="ggrep"
sed_binary="gsed"
;;
*) machine="UNKNOWN:${unameOut}" ;;
esac
printf "%-30s %s\n" "Operating system:" "${machine}"

file="../doublecmd.nuspec"
powershell="../tools/chocolateyinstall.ps1"

if [[ ! -f $file ]]; then
echo -e "${RED}File $file does not exist. Exiting.${NC}"
exit 1
fi

if [[ ! -f $powershell ]]; then
echo -e "${RED}File $powershell does not exist. Exiting.${NC}"
exit 1
fi

git checkout test
git pull
echo -e "${GREEN}Extracting version and id from $file...${NC}"
version=$($grep_command -oPm1 "(?<=<version>)[^<]+" "$file")
id=$($grep_command -oPm1 "(?<=<id>)[^<]+" "$file")
url=https://github.com/doublecmd/"$id"/releases/download/v"$version"/"$id"-"$version".i386-win32.msi
url64=https://github.com/doublecmd/"$id"/releases/download/v"$version"/"$id"-"$version".x86_64-win64.msi
checksum=$(curl -sL "$url" | sha256sum | cut -d' ' -f1)
checksum64=$(curl -sL "$url64" | sha256sum | cut -d' ' -f1)

printf "%-30s %s\n" "Version:" "${version}"
printf "%-30s %s\n" "ID:" "${id}"
printf "%-30s %s\n" "URL64:" "${url64}"
printf "%-30s %s\n" "Checksum64:" "${checksum64}"
printf "%-30s %s\n" "URL:" "${url}"
printf "%-30s %s\n" "Checksum:" "${checksum}"

# Check if the file under the URL64 exists
echo -e "${GREEN}Checking if the file under the URL64 exists...${NC}"
if curl --output /dev/null --silent --head --fail "$url64"; then
echo "File exists."
else
echo -e "${RED}File does not exist. Exiting.${NC}"
exit 1
fi

# Check if the file under the URL64 has the same checksum
echo -e "${GREEN}Checking if the file under the URL64 has the same checksum...${NC}"
remote_checksum=$(curl -sL "$url64" | sha256sum | cut -d ' ' -f 1)
if [ "$remote_checksum" == "$checksum64" ]; then
echo "Checksums match."
else
echo -e "${RED}Checksums do not match. Exiting.${NC}"
exit 1
fi

# Check if the file under the URL exists
echo -e "${GREEN}Checking if the file under the URL exists...${NC}"
if curl --output /dev/null --silent --head --fail "$url"; then
echo "File exists."
else
echo -e "${RED}File does not exist. Exiting.${NC}"
exit 1
fi

# Check if the file under the URL64 has the same checksum
echo -e "${GREEN}Checking if the file under the URL has the same checksum...${NC}"
remote_checksum=$(curl -sL "$url" | sha256sum | cut -d ' ' -f 1)
if [ "$remote_checksum" == "$checksum" ]; then
echo "Checksums match."
else
echo -e "${RED}Checksums do not match. Exiting.${NC}"
exit 1
fi

if [ -n "$version" ] && [ -n "$checksum64" ] && [ -n "$checksum" ]; then
echo -e "${GREEN}Version and checksum are not empty. Updating $powershell...${NC}"
"$sed_binary" -i "s|^\$version.*|\$version = '$version'|g" "$powershell"
"$sed_binary" -i "s|^\$checksum .*|\$checksum = '$checksum '|g" "$powershell"
"$sed_binary" -i "s|^\$checksum64.*|\$checksum64 = '$checksum64'|g" "$powershell"
echo "Updated $powershell with new version and checksum."
# Check if the tag exists
if git rev-parse --quiet --verify "$version" >/dev/null; then
echo "Tag already exists: $version"
else
# Create the tag
git add -A
git commit -m "Version ${version}"
git tag "$version"
git push origin "$version"
# Push the tag to the remote repository
#
echo "Tag created and pushed: $version"
fi

else

echo -e "${RED}Error: version or checksum is/are empty.${NC}"
printf "%-30s %s\n" "Version:" "${version}"
printf "%-30s %s\n" "Checksum:" "${checksum64}"
exit 1
fi

#########################################################
exit 0
2 changes: 1 addition & 1 deletion doublecmd.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>doublecmd</id>
<title>Double Commander for Windows</title>
<version>1.1.20</version>
<version>1.1.21</version>
<authors>Alexander Koblov, Przemyslaw Nagay</authors>
<owners>anydot, Marcin Bojko</owners>
<summary>Double Commander is a cross platform open source file manager with two panels side by side. It is inspired by Total Commander and features some new ideas.</summary>
Expand Down
6 changes: 3 additions & 3 deletions tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
$ErrorActionPreference = 'Stop';

$packageName = 'doublecmd'
$version = '1.1.20'
$version = '1.1.21'
$url = "https://github.com/doublecmd/doublecmd/releases/download/v$version/doublecmd-$version.i386-win32.msi"
$url64 = "https://github.com/doublecmd/doublecmd/releases/download/v$version/doublecmd-$version.x86_64-win64.msi"
$checksum = '4403ff1f3cbb22a777bbdfc1ed92e30fbc8a82fe1d4b4ec334c943df29b855d4 '
$checksum64 = '35fba505e17f0420be2621214b0e5deb8eb5aaf93561fe7d66d626ffb865422f'
$checksum = 'f1d23ddcf7b2f19ad8c4e4116adb344c7dc111265d0a9493e624fa3eb4f41fe5 '
$checksum64 = 'a7ca81c940c9037d9a6c85f61171a2ef94b70826644132a5a9ee0be8568a58ea'
$killexec = 1
$killexecprocess = "doublecmd*"

Expand Down

0 comments on commit d173e73

Please sign in to comment.