vncserver: extract CreateUserConfigIfNeeded()

This commit is contained in:
Dmitry Maksyoma 2021-08-02 23:26:17 +12:00
parent 08ede14dfe
commit 69a2f9a13b

View File

@ -129,14 +129,7 @@ if (! $skipxstartup) {
&CreateXstartupIfNeeded();
}
# Create the user's config file if necessary.
if (!(-e "$vncUserDir/config")) {
warn "Creating default config $vncUserDir/config\n";
open(VNCUSERCONFIG, ">$vncUserDir/config");
print VNCUSERCONFIG $defaultConfig;
close(VNCUSERCONFIG);
chmod 0644, "$vncUserDir/config";
}
&CreateUserConfigIfNeeded();
# Run the X startup script.
if (! $skipxstartup) {
@ -958,3 +951,15 @@ sub WaitForXvncToStart {
sub UsingSafeFontPath {
$fontPath eq $defFontPath
}
sub CreateUserConfigIfNeeded {
if (-e "$vncUserDir/config") {
return;
}
warn "Creating default config $vncUserDir/config\n";
open(VNCUSERCONFIG, ">$vncUserDir/config");
print VNCUSERCONFIG $defaultConfig;
close(VNCUSERCONFIG);
chmod 0644, "$vncUserDir/config";
}