Commit 93b791da authored by nanahira's avatar nanahira

fix

parent 69f81ea4
# ecvimlib.ps1: Editorconfig Vimscript core CLI, PowerShell version,
# library routines.
# Copyright (c) 2018--2019 Chris White. All rights reserved.
# Licensed CC-BY-SA, version 3.0 or any later version, at your option.
#
# N.B.: debug output uses Warning only because those are displayed by default.
#Requires -Version 3
# Get the directory of this script. From
# https://stackoverflow.com/a/5466355/2877364 by
# https://stackoverflow.com/users/23283/jaredpar
$global:DIR = $PSScriptRoot
### Set up debugging output ============================================
$global:debug=$env:EDITORCONFIG_DEBUG # Debug filename
if($global:debug -and ($global:debug -notmatch '^/')) {
# Relative to this script unless it starts with a slash. This is because
# cwd is usually not $DIR when testing.
$global:debug="${DIR}/${global:debug}"
}
### Process args =======================================================
function de64_args($argv) {
$argv | % {
$b64 = $_ -replace '-','=' -replace '_','/' -replace '\.','+'
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($b64))
}
}
### Helpers ============================================================
# Append a string to $debug in UTF-8 rather than the default UTF-16
filter global:D($file = $debug) {
if($debug) {
echo $_ | Out-File -FilePath $file -Encoding utf8 -Append
}
}
# Escape a string for Vim
function global:vesc($str) {
return "'" + ($str -replace "'","''") + "'"
}
# Escape a string for a command-line argument.
# See https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.arguments?view=netframework-4.7.2
function global:argesc($arg) {
return '"' + ($arg -replace '"','"""') + '"'
}
### Find the Vim EXE ===================================================
function global:Find-Vim
{
if($env:VIM_EXE) {
if($debug) { echo "Using env Vim $($env:VIM_EXE)" | D }
return $env:VIM_EXE
}
$vims = @(get-childitem 'c:\program files*\vim\**\vim.exe' | `
sort LastWriteTime -Descending) # @() => always array
# write-host ($vims | format-table | out-string) # DEBUG
# write-host ($vims | get-member | out-string)
if($vims.count -gt 0) {
if($debug) { echo "Using found Vim $($vims[0].FullName)" | D }
return $vims[0].FullName
}
throw "Could not find vim.exe. Please set VIM_EXE to the path to your Vim."
} #Find-Vim
### Runner =============================================================
# Run a process with the given arguments.
function global:run_process
{
param(
[Parameter(Mandatory=$true, Position=0)][string]$run,
[string]$extrapath,
[string]$stdout, # Redirect stdout to this file
[string]$stderr, # Redirect stderr to this file
[string[]]$argv # Arguments to $run
)
$si = new-object Diagnostics.ProcessStartInfo
if($extrapath) {
$si.EnvironmentVariables['path']+=";${extrapath}"
}
$si.FileName=$run
# Stringify the arguments (blech)
$argstr = $argv | % { (argesc $_) + ' ' }
$si.Arguments = $argstr;
if($debug) { echo "Running process $run with arguments >>$argstr<<" | D }
$si.UseShellExecute=$false
# DEBUG $si.RedirectStandardInput=$true
if($stdout) {
if($debug) { echo "Saving stdout to ${stdout}" | D }
$si.RedirectStandardOutput=$true;
}
if($stderr) {
if($debug) { echo "Saving stderr to ${stderr}" | D }
$si.RedirectStandardError=$true;
}
$p = [Diagnostics.Process]::Start($si)
# DEBUG $p.StandardInput.Close() # < /dev/null
$p.WaitForExit()
$retval = $p.ExitCode
if($stdout) {
echo "Standard output:" | D $stdout
$p.StandardOutput.ReadToEnd() | `
Out-File -FilePath $stdout -Encoding utf8 -Append
}
if($stderr) {
echo "Standard error:" | D $stderr
$p.StandardError.ReadToEnd() | `
Out-File -FilePath $stderr -Encoding utf8 -Append
}
$p.Close()
return $retval
}
if($debug) {
echo "======================================================" | D
Get-Date -format F | D
}
$global:VIM = Find-Vim
# ecvimlib.ps1: Editorconfig Vimscript core CLI, PowerShell version,
# library routines.
# Copyright (c) 2018--2019 Chris White. All rights reserved.
# Licensed CC-BY-SA, version 3.0 or any later version, at your option.
#
# N.B.: debug output uses Warning only because those are displayed by default.
#Requires -Version 3
# Get the directory of this script. From
# https://stackoverflow.com/a/5466355/2877364 by
# https://stackoverflow.com/users/23283/jaredpar
$global:DIR = $PSScriptRoot
### Set up debugging output ============================================
$global:debug=$env:EDITORCONFIG_DEBUG # Debug filename
if($global:debug -and ($global:debug -notmatch '^/')) {
# Relative to this script unless it starts with a slash. This is because
# cwd is usually not $DIR when testing.
$global:debug="${DIR}/${global:debug}"
}
### Process args =======================================================
function de64_args($argv) {
$argv | % {
$b64 = $_ -replace '-','=' -replace '_','/' -replace '\.','+'
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($b64))
}
}
### Helpers ============================================================
# Append a string to $debug in UTF-8 rather than the default UTF-16
filter global:D($file = $debug) {
if($debug) {
echo $_ | Out-File -FilePath $file -Encoding utf8 -Append
}
}
# Escape a string for Vim
function global:vesc($str) {
return "'" + ($str -replace "'","''") + "'"
}
# Escape a string for a command-line argument.
# See https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.arguments?view=netframework-4.7.2
function global:argesc($arg) {
return '"' + ($arg -replace '"','"""') + '"'
}
### Find the Vim EXE ===================================================
function global:Find-Vim
{
if($env:VIM_EXE) {
if($debug) { echo "Using env Vim $($env:VIM_EXE)" | D }
return $env:VIM_EXE
}
$vims = @(get-childitem 'c:\program files*\vim\**\vim.exe' | `
sort LastWriteTime -Descending) # @() => always array
# write-host ($vims | format-table | out-string) # DEBUG
# write-host ($vims | get-member | out-string)
if($vims.count -gt 0) {
if($debug) { echo "Using found Vim $($vims[0].FullName)" | D }
return $vims[0].FullName
}
throw "Could not find vim.exe. Please set VIM_EXE to the path to your Vim."
} #Find-Vim
### Runner =============================================================
# Run a process with the given arguments.
function global:run_process
{
param(
[Parameter(Mandatory=$true, Position=0)][string]$run,
[string]$extrapath,
[string]$stdout, # Redirect stdout to this file
[string]$stderr, # Redirect stderr to this file
[string[]]$argv # Arguments to $run
)
$si = new-object Diagnostics.ProcessStartInfo
if($extrapath) {
$si.EnvironmentVariables['path']+=";${extrapath}"
}
$si.FileName=$run
# Stringify the arguments (blech)
$argstr = $argv | % { (argesc $_) + ' ' }
$si.Arguments = $argstr;
if($debug) { echo "Running process $run with arguments >>$argstr<<" | D }
$si.UseShellExecute=$false
# DEBUG $si.RedirectStandardInput=$true
if($stdout) {
if($debug) { echo "Saving stdout to ${stdout}" | D }
$si.RedirectStandardOutput=$true;
}
if($stderr) {
if($debug) { echo "Saving stderr to ${stderr}" | D }
$si.RedirectStandardError=$true;
}
$p = [Diagnostics.Process]::Start($si)
# DEBUG $p.StandardInput.Close() # < /dev/null
$p.WaitForExit()
$retval = $p.ExitCode
if($stdout) {
echo "Standard output:" | D $stdout
$p.StandardOutput.ReadToEnd() | `
Out-File -FilePath $stdout -Encoding utf8 -Append
}
if($stderr) {
echo "Standard error:" | D $stderr
$p.StandardError.ReadToEnd() | `
Out-File -FilePath $stderr -Encoding utf8 -Append
}
$p.Close()
return $retval
}
if($debug) {
echo "======================================================" | D
Get-Date -format F | D
}
$global:VIM = Find-Vim
@echo off
:: editorconfig.bat: First-level invoker for editorconfig-core-vimscript
:: and editorconfig-vim.
:: Just passes the full command line to editorconfig1.vbs, since VBScript
:: applies very simple quoting rules when it parses a command line.
:: Copyright (c) 2018--2019 Chris White. All rights reserved.
:: Licensed CC-BY-SA, version 3.0 or any later version, at your option.
set here=%~dp0
cscript //Nologo "%here%editorconfig1.vbs" %*
:: %* has the whole command line
@echo off
:: editorconfig.bat: First-level invoker for editorconfig-core-vimscript
:: and editorconfig-vim.
:: Just passes the full command line to editorconfig1.vbs, since VBScript
:: applies very simple quoting rules when it parses a command line.
:: Copyright (c) 2018--2019 Chris White. All rights reserved.
:: Licensed CC-BY-SA, version 3.0 or any later version, at your option.
set here=%~dp0
cscript //Nologo "%here%editorconfig1.vbs" %*
:: %* has the whole command line
' editorconfig1.vbs: run by editorconfig.bat
' runs editorconfig2.ps1
' Part of editorconfig-core-vimscript and editorconfig-vim.
'
' Copyright (c) 2018--2019 Chris White. All rights reserved.
' Licensed CC-BY-SA, version 3.0 or any later version, at your option.
'
' Modified from
' https://stackoverflow.com/a/2470557/2877364 by
' https://stackoverflow.com/users/2441/aphoria
' Thanks to https://www.geekshangout.com/vbs-script-to-get-the-location-of-the-current-script/
currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
' Load our common library. Thanks to https://stackoverflow.com/a/316169/2877364
With CreateObject("Scripting.FileSystemObject")
executeGlobal .openTextFile(currentScriptPath & "ecvbslib.vbs").readAll()
End With
' === MAIN ==================================================================
' Encode all the arguments as modified base64 so there will be no quoting
' issues when we invoke powershell.
b64args = MakeY64Args(Wscript.Arguments)
' Quote script name just in case
ps1name = QuoteForShell(currentScriptPath & "editorconfig2.ps1")
'Wscript.Echo "Script is in " & ps1name
if True then
retval = RunCommandAndEcho( "powershell.exe" & _
" -executionpolicy bypass -file " & ps1name & " " & join(b64args) _
)
' add -noexit to leave window open so you can see error messages
WScript.Quit retval
end if
' vi: set ts=4 sts=4 sw=4 et ai:
' editorconfig1.vbs: run by editorconfig.bat
' runs editorconfig2.ps1
' Part of editorconfig-core-vimscript and editorconfig-vim.
'
' Copyright (c) 2018--2019 Chris White. All rights reserved.
' Licensed CC-BY-SA, version 3.0 or any later version, at your option.
'
' Modified from
' https://stackoverflow.com/a/2470557/2877364 by
' https://stackoverflow.com/users/2441/aphoria
' Thanks to https://www.geekshangout.com/vbs-script-to-get-the-location-of-the-current-script/
currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")
' Load our common library. Thanks to https://stackoverflow.com/a/316169/2877364
With CreateObject("Scripting.FileSystemObject")
executeGlobal .openTextFile(currentScriptPath & "ecvbslib.vbs").readAll()
End With
' === MAIN ==================================================================
' Encode all the arguments as modified base64 so there will be no quoting
' issues when we invoke powershell.
b64args = MakeY64Args(Wscript.Arguments)
' Quote script name just in case
ps1name = QuoteForShell(currentScriptPath & "editorconfig2.ps1")
'Wscript.Echo "Script is in " & ps1name
if True then
retval = RunCommandAndEcho( "powershell.exe" & _
" -executionpolicy bypass -file " & ps1name & " " & join(b64args) _
)
' add -noexit to leave window open so you can see error messages
WScript.Quit retval
end if
' vi: set ts=4 sts=4 sw=4 et ai:
; test EditorConfig files with CRLF line separators
root = true
[*]
key = value
; test EditorConfig files with CRLF line separators
root = true
[*]
key = value
......@@ -21,7 +21,7 @@
become: true
apt:
update_cache: true
name: 'git,nvidia-driver-{{ nvidia_driver_version }},nvidia-cuda-dev,nvidia-cuda-gdb,nvidia-cuda-toolkit,nvidia-cuda-toolkit-gcc,nvidia-container-runtime,libnvidia-encode-{{ nvidia_driver_version }},libnvidia-decode-{{ nvidia_driver_version }},libnvidia-fbc1-{{ nvidia_driver_version }},libnvidia-compute-{{ nvidia_driver_version }},libnvidia-gl-{{ nvidia_driver_version }}'
name: 'git,nvidia-driver-{{ nvidia_driver_version }},nvidia-container-runtime,libnvidia-encode-{{ nvidia_driver_version }},libnvidia-decode-{{ nvidia_driver_version }},libnvidia-fbc1-{{ nvidia_driver_version }},libnvidia-compute-{{ nvidia_driver_version }},libnvidia-gl-{{ nvidia_driver_version }}'
install_recommends: false
- name: check detailed driver version
changed_when: false
......@@ -41,23 +41,6 @@
check_file: libnvidia-fbc-backup/libnvidia-fbc.so
- script: patch.sh
check_file: libnvidia-encode-backup/libnvidia-encode.so
- name: check install of cudnn
find:
paths:
- /usr/lib/x86_64-linux-gnu
patterns: 'libcudnn.so.8.4.0'
register: cudnn_result
- name: purge cudnn7
become: true
apt:
name: libcudnn7,libcudnn7-dev,libcudnn7-doc
state: absent
- name: install cudnn
become: true
apt:
deb: 'https://cdn02.moecube.com:444/init/cudnn/{{item}}'
with_items:
- libcudnn8_8.4.0.27-1+cuda11.6_amd64.deb
- libcudnn8-dev_8.4.0.27-1+cuda11.6_amd64.deb
- libcudnn8-samples_8.4.0.27-1+cuda11.6_amd64.deb
when: not cudnn_result.files[0] is defined and ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int >= 20
- name: cuda
include_tasks: nvidia_cuda.yml
when: nvidia_driver_version <= 510
......@@ -35,7 +35,7 @@
blockinfile:
path: /etc/ssh/sshd_config
block: |
HostKeyAlgorithms=ssh-rsa,ssh-rsa-cert-v01@openssh.com
HostKeyAlgorithms=+ssh-rsa,ssh-rsa-cert-v01@openssh.com
PubkeyAcceptedAlgorithms=+ssh-rsa,ssh-rsa-cert-v01@openssh.com
marker: '# {mark} MyCard Init block'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 22
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment