Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dev directory during setup #255

Merged
merged 5 commits into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions installer/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ Source: {#SourcePath}\NOTICE.txt; DestDir: {app}; Flags: replacesameversion; Aft
Source: {#SourcePath}\..\edit-git-bash.exe; Flags: dontcopy

[Dirs]
Name: "{app}\dev"
Name: "{app}\dev\mqueue"
Name: "{app}\dev\shm"
Name: "{app}\tmp"

[Icons]
Expand Down Expand Up @@ -2318,6 +2321,52 @@ begin
LogError(ExpandConstant('Line {#__LINE__}: Unable to remove the Git for Windows updater (output: '+ReadFileAsString(LogPath)+', errors: '+ReadFileAsString(ErrPath)+').'));
end;

{
Create Cygwin's idea of a symbolic link:
- a system file
- starting with the prefix `!<symlink>\xff\xfe`
- followed by the symlink target, in UTF-16
- ending in two NUL bytes (reflecting a UTF-16 NUL)
}

function GetFileAttributes(Path:PAnsiChar):DWORD;
external '[email protected] stdcall';

function SetFileAttributes(Path:PAnsiChar;dwFileAttributes:DWORD):BOOL;
external '[email protected] stdcall';

function CreateCygwinSymlink(SymlinkPath,TargetPath:String):Boolean;
var
Attribute:DWord;
i:Integer;
begin
Result:=True;

// assuming that the target is actually all-ASCII, convert to UTF-16
for i:=Length(TargetPath) downto 1 do
TargetPath:=Copy(TargetPath,1,i)+#0+Copy(TargetPath,i+1,Length(TargetPath)-i);

// insert `!<symlink>\xff\xfe` prefix, and append `\0\0`
TargetPath:='!<symlink>'+#255+#254+TargetPath+#0+#0;

// write the file
if not SaveStringToFile(SymlinkPath,TargetPath,False) then begin
LogError('Could not write "'+SymlinkPath+'"');
Result:=False;
end;

// Set system bit (required for Cygwin to interpret this as a symlink)
Attribute:=GetFileAttributes(SymlinkPath);
if (Attribute and 4) = 0 then
begin
Attribute:=Attribute or 4;
if not SetFileAttributes(SymlinkPath,Attribute) then begin
LogError('Could not mark "'+SymlinkPath+'" as system file');
Result:=False;
end;
end;
end;

procedure CurStepChanged(CurStep:TSetupStep);
var
ProgramData,DllPath,FileName,Cmd,Msg,Ico:String;
Expand Down Expand Up @@ -2361,6 +2410,15 @@ begin

MaybeHardlinkDLLFiles();

{
Create the symlinks in `/dev/`
}

CreateCygwinSymlink(AppDir+'\dev\fd','/proc/self/fd');
CreateCygwinSymlink(AppDir+'\dev\stdin','/proc/self/fd/0');
CreateCygwinSymlink(AppDir+'\dev\stdout','/proc/self/fd/1');
CreateCygwinSymlink(AppDir+'\dev\stderr','/proc/self/fd/2');

{
Create the built-ins
}
Expand Down
1 change: 1 addition & 0 deletions installer/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ do
exit 1
fi
inno_defines="$inno_defines$LF#define DEBUG_WIZARD_PAGE '$page'$LF#define OUTPUT_TO_TEMP ''"
inno_defines="$inno_defines$LF[Code]${LF}function SetSystemConfigDefaults():Boolean;${LF}begin${LF} Result:=True;${LF}end;${LF}${LF}"
skip_files=t
;;
--output=*)
Expand Down
3 changes: 3 additions & 0 deletions nuget/GitForWindows.nuspec.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<file src="$buildextra$\ReleaseNotes.css" target="content" />
<file src="$buildextra$\nuget\Install.ps1" target="tools" />
<file src="$buildextra$\post-install.bat" target="tools" />
<file src="$buildextra$\emptydir" target="tools\dev" />
<file src="$buildextra$\emptydir" target="tools\dev\mqueue" />
<file src="$buildextra$\emptydir" target="tools\dev\shm" />
<file src="$buildextra$\nuget\package-versions.txt" target="tools\etc" />
@@FILELIST@@
</files>
Expand Down
3 changes: 3 additions & 0 deletions nuget/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ sed -e "s/@@VERSION@@/$VERSION/g" -e "s/@@AUTHOR@@/$AUTHOR/g" \
-e "s/@@VERSIONTAG@@/$VERSIONTAG/g" \
-e "s/@@ID@@/$ID/g" -e '/@@FILELIST@@/,$d' <"$SPECIN" >"$SPEC"

mkdir -p "$BUILDEXTRA/emptydir" ||
die "Could not generate empty directory."

# Make a list of files to include
LIST="$(ARCH=$ARCH BITNESS=$BITNESS \
PACKAGE_VERSIONS_FILE="$BUILDEXTRA"/nuget/package-versions.txt \
Expand Down
6 changes: 6 additions & 0 deletions portable/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ esac
cp "$SCRIPT_PATH/../LICENSE.txt" "$SCRIPT_PATH/root/" ||
die "Could not copy license file"

mkdir -p "$SCRIPT_PATH/root/dev/mqueue" ||
die "Could not make /dev/mqueue directory"

mkdir -p "$SCRIPT_PATH/root/dev/shm" ||
die "Could not make /dev/shm/ directory"

mkdir -p "$SCRIPT_PATH/root/etc" ||
die "Could not make etc/ directory"

Expand Down