-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently only visible in the VERSIONINFO in the executable Fixes #2
- Loading branch information
Showing
7 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ indent_style = space | |
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.sh] | ||
end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ Debug/ | |
Release/ | ||
x64/ | ||
*.user | ||
version-git.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// // | ||
// RebootAt - Reboot Windows at a given time // | ||
// Copyright (C) 2023 Frank Fesevur // | ||
// // | ||
// This program is free software; you can redistribute it and/or modify // | ||
// it under the terms of the GNU General Public License as published by // | ||
// the Free Software Foundation; either version 2 of the License, or // | ||
// (at your option) any later version. // | ||
// // | ||
// This program is distributed in the hope that it will be useful, // | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of // | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | ||
// GNU General Public License for more details. // | ||
// // | ||
// You should have received a copy of the GNU General Public License // | ||
// along with this program; if not, write to the Free Software // | ||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // | ||
// // | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#include <windows.h> | ||
#include "version-git.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// Version Information | ||
|
||
VS_VERSION_INFO VERSIONINFO | ||
FILEVERSION VERSION_NUMBER | ||
PRODUCTVERSION VERSION_NUMBER | ||
FILEFLAGSMASK 0x3fL | ||
FILEFLAGS 0 | ||
FILEOS VOS_NT_WINDOWS32 | ||
FILETYPE VFT_APP | ||
FILESUBTYPE VFT2_UNKNOWN | ||
{ | ||
BLOCK "VarFileInfo" | ||
{ | ||
VALUE "Translation", 0x409, 1200 | ||
} | ||
BLOCK "StringFileInfo" | ||
{ | ||
BLOCK "040904b0" | ||
{ | ||
VALUE "CompanyName", "Frank Fesevur" | ||
VALUE "FileDescription", "Reboot Windows at a given time" | ||
VALUE "FileVersion", VERSION_NUMBER_STR | ||
VALUE "InternalName", "RebootAt.exe" | ||
VALUE "LegalCopyright", COPYRIGHT_STR | ||
VALUE "OriginalFilename", "RebootAt.exe" | ||
VALUE "ProductName", "RebootAt" | ||
VALUE "ProductVersion", VERSION_NUMBER_STR | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@echo off | ||
|
||
REM Is Git for Windows x64 installed? | ||
if exist "%ProgramW6432%\Git\bin\bash.exe" ( | ||
|
||
echo Using bash from Git for Windows x64 | ||
setlocal | ||
PATH=%ProgramW6432%\Git\mingw64\bin;%ProgramW6432%\Git\bin | ||
bash version-git.sh | ||
exit /b 0 | ||
) | ||
|
||
REM Is Cygwin installed? | ||
if exist C:\Cygwin\bin\bash.exe ( | ||
|
||
echo Using bash from Cygwin | ||
setlocal | ||
PATH=C:\Cygwin\bin | ||
bash version-git.sh | ||
exit /b 0 | ||
) | ||
|
||
REM Is Cygwin64 installed? | ||
if exist C:\Cygwin64\bin\bash.exe ( | ||
|
||
echo Using bash from Cygwin64 | ||
setlocal | ||
PATH=C:\Cygwin64\bin | ||
bash version-git.sh | ||
exit /b 0 | ||
) | ||
|
||
REM No Cygwin or Git for Windows installed | ||
REM If there is a file assume if is properly generated | ||
if exist version-git.h ( | ||
echo No bash found, but version-git.h exists | ||
exit /b 0 | ||
) | ||
|
||
echo No bash found | ||
exit /b 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
function check_if_installed() | ||
{ | ||
# Go through all the tools that need to be checked | ||
for i in $* | ||
do | ||
# Is tool installed? | ||
if ! type "$i" >/dev/null 2>&1 | ||
then | ||
echo "Required tool \"$i\" not found!" | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
function create_version_git_h() | ||
{ | ||
# Make sure there is a file, but don't touch it if not needed | ||
[[ -f version-git.h ]] || touch version-git.h | ||
|
||
# Make sure the locale is set properly | ||
export LANG=en_US.UTF8 | ||
|
||
# Get the version info from git | ||
echo "Retrieving version information from git..." | ||
GIT_VERSION=$(git describe --tags --match 'v[0-9]*') | ||
echo "Found version $GIT_VERSION" | ||
|
||
# Has the version changed? | ||
if grep --quiet $GIT_VERSION version-git.h | ||
then | ||
echo "Latest version info already in version-git.h" | ||
exit 0 | ||
fi | ||
|
||
# Get additional version info from git | ||
echo "Retrieving additional version information from git..." | ||
VERSION=$(git describe --tags --abbrev=0 | grep -oP '\d+\.\d+\.\d+') | ||
VERSION_NUMBERS=$(echo $VERSION | tr "." ","),0 | ||
YEAR=$(date +%Y) | ||
|
||
echo "Generating version-git.h..." | ||
echo "#pragma once" > version-git.h | ||
echo "#define VERSION_NUMBER $VERSION_NUMBERS" >> version-git.h | ||
echo "#define VERSION_NUMBER_STR \"$VERSION\"" >> version-git.h | ||
echo "#define VERSION_NUMBER_WSTR L\"$VERSION\"" >> version-git.h | ||
echo "#define COPYRIGHT_STR \"Copyright (c) 2023-$YEAR by Frank Fesevur\"" >> version-git.h | ||
echo "#define VERSION_GIT_STR \"$GIT_VERSION\"" >> version-git.h | ||
echo "#define VERSION_GIT_WSTR L\"$GIT_VERSION\"" >> version-git.h | ||
} | ||
|
||
# Check if all the tools we need are installed | ||
check_if_installed git grep tr date | ||
|
||
create_version_git_h |