mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 07:20:32 +00:00
change scripts to be independent from the working directory
This commit is contained in:
parent
f7ffa6f5e4
commit
938aafd36e
4 changed files with 55 additions and 13 deletions
|
@ -1,6 +1,17 @@
|
||||||
if (!((Split-Path -Path (Get-Location) -Leaf) -eq "build"))
|
# make sure we are in the correct directory
|
||||||
|
$currentDir=Get-Location
|
||||||
|
if ("$currentDir" -ne "$PSScriptRoot")
|
||||||
{
|
{
|
||||||
Write-Output "This script must be run inside the build folder. Press ENTER to exit."; Read-Host; exit
|
try
|
||||||
|
{
|
||||||
|
pushd "$PSScriptRoot"
|
||||||
|
. $PSCommandPath
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||||
|
|
|
@ -2,7 +2,16 @@
|
||||||
|
|
||||||
# Build Distro ISO using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and export ISO
|
# Build Distro ISO using AUTO.ISO minimal auto-install as bootstrap to merge codebase, recompile system, and export ISO
|
||||||
|
|
||||||
# Run this script inside build/ directory
|
# make sure we are in the correct directory
|
||||||
|
SCRIPT_DIR=$(realpath "$(dirname "$0")")
|
||||||
|
SCRIPT_NAME=$(basename "$0")
|
||||||
|
EXPECTED_DIR=$(realpath "$PWD")
|
||||||
|
|
||||||
|
if test "${EXPECTED_DIR}" != "${SCRIPT_DIR}"
|
||||||
|
then
|
||||||
|
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" );
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# Uncomment if you use doas instead of sudo
|
# Uncomment if you use doas instead of sudo
|
||||||
#alias sudo=doas
|
#alias sudo=doas
|
||||||
|
|
|
@ -1,4 +1,20 @@
|
||||||
$choice = $args[0]
|
# make sure we are in the correct directory
|
||||||
|
$currentDir=Get-Location
|
||||||
|
if ("$currentDir" -ne "$PSScriptRoot")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pushd "$PSScriptRoot"
|
||||||
|
. $PSCommandPath
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$choice = $args[0]
|
||||||
|
|
||||||
function print_usage()
|
function print_usage()
|
||||||
{
|
{
|
||||||
|
@ -19,11 +35,6 @@ if ($choice -ne 'repo' -and $choice -ne "vm")
|
||||||
print_usage
|
print_usage
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((Split-Path -Path (Get-Location) -Leaf) -eq "build"))
|
|
||||||
{
|
|
||||||
Write-Output "This script must be run inside the build folder. Press ENTER to exit."; Read-Host; exit
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
|
||||||
{
|
{
|
||||||
Write-Output "This script must be run as Adminstrator. Press ENTER to exit."; Read-Host; exit
|
Write-Output "This script must be run as Adminstrator. Press ENTER to exit."; Read-Host; exit
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Sync VM <--> Repo.
|
# Sync VM <--> Repo.
|
||||||
# Run this script inside build/ directory.
|
|
||||||
#
|
#
|
||||||
# On copying from virtual disk to src/, the directory is emptied before copy. Comment out "rm -rf ../src/*" to copy onto src.
|
# On copying from virtual disk to src/, the directory is emptied before copy. Comment out "rm -rf ../src/*" to copy onto src.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# make sure we are in the correct directory
|
||||||
|
SCRIPT_DIR=$(realpath "$(dirname "$0")")
|
||||||
|
SCRIPT_NAME=$(basename "$0")
|
||||||
|
EXPECTED_DIR=$(realpath "$PWD")
|
||||||
|
|
||||||
|
if test "${EXPECTED_DIR}" != "${SCRIPT_DIR}"
|
||||||
|
then
|
||||||
|
( cd "$SCRIPT_DIR" || exit ; "./$SCRIPT_NAME" );
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Uncomment if you use doas instead of sudo
|
# Uncomment if you use doas instead of sudo
|
||||||
#alias sudo=doas
|
#alias sudo=doas
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue