Commit 93b791da authored by nanahira's avatar nanahira

fix

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