mirror of
https://github.com/black7375/Firefox-UI-Fix.git
synced 2025-12-06 02:30:54 -08:00
Add: Install - custom apply script port to pwsh
This commit is contained in:
parent
4e0f996fa7
commit
736004f90a
1 changed files with 81 additions and 0 deletions
81
install.ps1
81
install.ps1
|
|
@ -634,6 +634,76 @@ function Check-InstallTypes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#== Custom Install =============================================================
|
||||||
|
$customFiles = @(
|
||||||
|
"user-overrides.js",
|
||||||
|
"userChrome-overrides.css",
|
||||||
|
"userContent-overrides.css"
|
||||||
|
)
|
||||||
|
|
||||||
|
$customFileExist = $false
|
||||||
|
function Check-CustomFiles() {
|
||||||
|
$global:customFiles = Filter-Path $customFiles
|
||||||
|
|
||||||
|
if ( $global:customFiles.Length -gt 0 ) {
|
||||||
|
$global:customFileExist = $true
|
||||||
|
Lepton-OKMessage "Check custom file detected"
|
||||||
|
|
||||||
|
foreach ( $customFile in $global:customFiles ) {
|
||||||
|
Write-Host "- ${customFile}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Copy-CustomFiles() {
|
||||||
|
if ( "${customFileExist}" -eq $true ) {
|
||||||
|
# If Release or Network mode, Local is passed (Already copied)
|
||||||
|
if ( "${leptonInstallType}" -ne "Local" ) {
|
||||||
|
foreach ( $profilePath in $global:firefoxProfilePaths ) {
|
||||||
|
foreach ( $customFile in $global:customFiles ) {
|
||||||
|
if ( "${customFile}" -eq "user-overrides.js" ) {
|
||||||
|
Copy-Auto "${customFile}" "${profilePath}\${customFile}"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Copy-Auto "${customFile}" "${profilePath}\chrome\${customFile}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Lepton-OKMessage "End custom file copy"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$customFileApplied = $false
|
||||||
|
function Apply-CustomFiles() {
|
||||||
|
foreach ( $profilePath in $global:firefoxProfilePaths ) {
|
||||||
|
foreach ( $customFile in $global:customFiles ) {
|
||||||
|
$local:targetFile = $customFile.Replace("-overrides", "")
|
||||||
|
if ( "${customFile}" -eq "user-overrides.js" ) {
|
||||||
|
if ( Test-Path -Path "${profilePath}\user-overrides.js" -PathType leaf ) {
|
||||||
|
$global:customFileApplied = $true
|
||||||
|
Get-Content -Path "${profilePath}\user-overrides.js" >> "${profilePath}\${targetFile}"
|
||||||
|
}
|
||||||
|
elseif ( Test-Path -Path "${profilePath}\chrome\user-overrides.js" -PathType leaf ) {
|
||||||
|
$global:customFileApplied = $true
|
||||||
|
Get-Content -Path "${profilePath}\chrome\user-overrides.js" >> "${profilePath}\${targetFile}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( Test-Path -Path "${profilePath}\${customFile}" -PathType leaf ) {
|
||||||
|
$global:customFileApplied = $true
|
||||||
|
Get-Content -Path "${profilePath}\chrome\${customFile}" >> "${profilePath}\${targetFile}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "${customFileApplied}" -eq $true ) {
|
||||||
|
Lepton-OKMessage "Custom file applied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#== Install Helpers ============================================================
|
#== Install Helpers ============================================================
|
||||||
$chromeDuplicate = $false
|
$chromeDuplicate = $false
|
||||||
function Check-ChromeExist() {
|
function Check-ChromeExist() {
|
||||||
|
|
@ -692,10 +762,14 @@ function Copy-Lepton() {
|
||||||
#== Each Install ===============================================================
|
#== Each Install ===============================================================
|
||||||
function Install-Local() {
|
function Install-Local() {
|
||||||
Copy-Lepton "${currentDir}" "user.js"
|
Copy-Lepton "${currentDir}" "user.js"
|
||||||
|
Copy-CustomFiles
|
||||||
|
Apply-CustomFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-Release() {
|
function Install-Release() {
|
||||||
Copy-Lepton "chrome" "user.js"
|
Copy-Lepton "chrome" "user.js"
|
||||||
|
Copy-CustomFiles
|
||||||
|
Apply-CustomFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-Network() {
|
function Install-Network() {
|
||||||
|
|
@ -704,6 +778,8 @@ function Install-Network() {
|
||||||
|
|
||||||
Clone-Lepton
|
Clone-Lepton
|
||||||
Copy-Lepton
|
Copy-Lepton
|
||||||
|
Copy-CustomFiles
|
||||||
|
Apply-CustomFiles
|
||||||
|
|
||||||
Clean-Lepton
|
Clean-Lepton
|
||||||
Check-ChromeRestore
|
Check-ChromeRestore
|
||||||
|
|
@ -773,6 +849,9 @@ function Update-Profile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Apply-CustomFiles
|
||||||
|
|
||||||
Clean-Lepton
|
Clean-Lepton
|
||||||
Check-ChromeRestore
|
Check-ChromeRestore
|
||||||
}
|
}
|
||||||
|
|
@ -795,6 +874,8 @@ function Install-Lepton {
|
||||||
Update-ProfilePaths
|
Update-ProfilePaths
|
||||||
Write-LeptonInfo
|
Write-LeptonInfo
|
||||||
|
|
||||||
|
Check-CustomFiles
|
||||||
|
|
||||||
if ( $updateMode ) {
|
if ( $updateMode ) {
|
||||||
Update-Profile
|
Update-Profile
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue