diff --git a/Server/Repo.Update.sh b/Server/Repo.Update.sh index 89afbbb..7e00768 100755 --- a/Server/Repo.Update.sh +++ b/Server/Repo.Update.sh @@ -19,18 +19,16 @@ mkcd ./Root CpItem "etc/systemd/system/${f}.timer" done + CpSufx "Main/Server/VMs/*." sh + for f in \ WindowsServer2022 Windows7Earnapp1 \ ; do CpItem "etc/systemd/system/Vm${f}.service" done - #CpItem etc/nginx/nginx.conf - #CpSufx "etc/nginx/sites-available/*." conf old - #CpItem etc/tor/torrc - CpSufx "Main/Server/Scripts/*." sh CpSufx "Main/Server/Scripts/Backup/*." sh cfg - CpSufx "Main/Server/Scripts/Interactive/*." sh + CpItem Main/Server/Scripts/Interactive #CpItem Main/Server/Scripts/OneShot.AfterBoot.sh #CpItem Main/Server/Scripts/RenewCerts.sh @@ -42,11 +40,6 @@ mkcd ./Root CpSufx "etc/nginx/sites-available/*." conf old CpItem etc/tor/torrc - #for f in \ - # SpaccBBS.conf SpaccCloud.conf XSpacc.conf admin.conf analytics.conf articles.conf feeds.conf root.conf \ - #; do CpItem "etc/nginx/sites-available/${f}" - #done - ScopePath=/var/lib/lxc/Ubuntu2023-SpaccCraft/rootfs/ CpItem etc/systemd/system/SpaccCraft.service diff --git a/Server/Root/Main/Server/Scripts/Interactive/EPSON_WF-2510_Color-Filter_and_Print.zx.mjs b/Server/Root/Main/Server/Scripts/Interactive/EPSON_WF-2510_Color-Filter_and_Print.zx.mjs new file mode 100755 index 0000000..93ced10 --- /dev/null +++ b/Server/Root/Main/Server/Scripts/Interactive/EPSON_WF-2510_Color-Filter_and_Print.zx.mjs @@ -0,0 +1,66 @@ +#!/usr/bin/env zx + +let Inputs = $.env.Document; + +//let Output = Input.split('.').slice(0,-1).join('.') + '.out.' + Input.split('.').slice(-1)[0]; +let Output = `${Inputs}.out/` + Inputs.split('/').slice(-1)[0]; +await fs.mkdir(`${Inputs}.out`); + +// TODO: if inputs is zipped folder, extract it and iterate +Inputs = [Inputs]; + +for (let Input of Inputs) { + let Ext = Input.split('.').slice(-1)[0]; + + let Intermid = Input; + //let Intermid = `${Input}-${Math.random()}.${Ext}`; + //await fs.copy(Input, Intermid); + + //let Background = Input.split('.').slice(0,-1).join('.') + '.bg.' + Input.split('.').slice(-1)[0]; + let Background = `${Input}.bg.${Ext}`; + await fs.copy(Input, Background); + + await $`convert ${Input} -modulate ${$.env.Brightness} ${Intermid}`; + + if ($.env.FilterMode.startsWith('Compose:')) { + await $`convert ${Background} -fill ${$.env.FilterColor} -colorize 100% ${Background}`; + await $`composite -compose ${$.env.FilterMode.split(':')[1].trim()} ${Input} ${Background} ${Intermid}`; + }; + + await fs.copy(Intermid, Output); + + let WhichPdf = await $`lp -d PDF -o scaling=${$.env.Scaling} -o position=${$.env.Position} ${Intermid}`; + WhichPdf = WhichPdf.toString().split('request id is PDF-').slice(-1)[0].split(' ')[0]; + //WhichPdf = await $`s(){ $@ ;}; s $(s ${'ls ~/PDF/*-job_' + WhichPdf + '.pdf'})`; + //await sleep(3000); + //await $`ls ~/PDF/*-job_${WhichPdf}.pdf`; + WhichPdf = await retry(999, expBackoff(), () => $`ls ~/PDF/*-job_${WhichPdf}.pdf`); + WhichPdf = WhichPdf.toString().trim(); + //let ListPdf = await $`ls ~/PDF/*-job_*.pdf`; + //for (let File of ListPdf.toString().split(' ')) { + // echo`${File}`; + // if (File.endsWith(`-job_${WhichPdf}.pdf`)) { + // WhichPdf = File; + // break; + // }; + //}; + //echo`${WhichPdf}`; + //let ListPdf = await $`ls "$HOME/PDF/"`; + //echo`${ListPdf.toString().split(' ')}`; + //ListPdf = ListPdf.toString().split(' '); + //echo`1:${WhichPdf.toString()}`; + //WhichPdf = await $`ls ~/PDF/*-job_${WhichPdf}.pdf`; + //WhichPdf = await glob(`~/PDF/*-job_${WhichPdf}.pdf`); + + let OutputPdf = `${Output}.cups-pdf.pdf`; + await sleep(1500); + //await fs.copy(WhichPdf, OutputPdf); + //await fs.unlink(WhichPdf); + await fs.rename(WhichPdf, OutputPdf); + await sleep(1500); + + if ($.env.PrintJob === 'Yes') { + await $`lp -d EPSON_WF-2510_Series ${OutputPdf}`; + echo``; + }; +}; diff --git a/Server/Root/Main/Server/Scripts/Interactive/Mirror_Git_Repo.zx.mjs b/Server/Root/Main/Server/Scripts/Interactive/Mirror_Git_Repo.zx.mjs new file mode 100755 index 0000000..cd02ae2 --- /dev/null +++ b/Server/Root/Main/Server/Scripts/Interactive/Mirror_Git_Repo.zx.mjs @@ -0,0 +1,14 @@ +#!/usr/bin/env zx + +let Name = $.env.Url.split('//')[1].split('/')[0].replaceAll('.', '-') + '.' + $.env.Url.split('/').slice(-2).join('.'); +let GitBranch = ``; + +if ($.env.Branch) { + Name += `.${$.env.Branch}`; + GitBranch = `--branch=${$.env.Branch}`; +}; + +cd(`/Main/Server/www/Drive/Repos`); +await $`git clone --depth=1 --recursive ${GitBranch} ${$.env.Url} ./${Name}`; +await $`tar cvJSf ./${Name}.tar.xz ./${Name}`; +await $`rm -rf ./${Name}`; diff --git a/Server/Root/Main/Server/VMs/Windows7Earnapp1.sh b/Server/Root/Main/Server/VMs/Windows7Earnapp1.sh new file mode 100755 index 0000000..8650233 --- /dev/null +++ b/Server/Root/Main/Server/VMs/Windows7Earnapp1.sh @@ -0,0 +1,16 @@ +#!/bin/sh +cd "$( dirname "$( realpath "$0" )" )" + +qemu-system-x86_64 \ + -accel kvm \ + -cpu host \ + -smp 1 \ + -m 256M \ + -hda ./Windows7Earnapp1.qcow2 \ + -display none \ +; +# -cdrom ./Windows7Custom2.iso \ +# -vnc :10 \ +# -display none \ + +while true; do sleep 999; done diff --git a/Server/Root/Main/Server/VMs/WindowsServer2022.sh b/Server/Root/Main/Server/VMs/WindowsServer2022.sh new file mode 100755 index 0000000..b99875f --- /dev/null +++ b/Server/Root/Main/Server/VMs/WindowsServer2022.sh @@ -0,0 +1,28 @@ +#!/bin/sh +cd "$( dirname "$( realpath "$0" )" )" + +#qemu-system-x86_64 \ +/opt/usr/bin/qemu-system-x86_64 \ + -accel kvm \ + -bios /usr/share/qemu/OVMF.fd \ + -smbios type=0,version=UX305UA.201 \ + -smbios type=1,manufacturer=ASUS,product=UX305UA,version=2021.1 \ + -smbios "type=2,manufacturer=Intel,version=2021.5,product=Intel i9-12900K" \ + -smbios type=3,manufacturer=XBZJ \ + -smbios type=17,manufacturer=KINGSTON,loc_pfx=DDR5,speed=4800,serial=000000,part=0000 \ + -smbios type=4,manufacturer=Intel,max-speed=4800,current-speed=4800 \ + -cpu "host,family=6,model=158,stepping=2,model_id=Intel(R) Core(TM) i9-12900K CPU @ 2.60GHz,vmware-cpuid-freq=false,enforce=false,host-phys-bits=true,hypervisor=off" \ + -machine q35,kernel_irqchip=on \ + -smp 2 \ + -m 3840M \ + -hda ./WindowsServer2022.qcow2 \ + -device e1000,netdev=net0 \ + -netdev user,id=net0,hostfwd=tcp::3389-:3389,hostfwd=udp::3389-:3389 \ + -display none \ +; +# -bios /usr/share/qemu/OVMF.fd \ +# -cdrom ./SERVER_EVAL_x64FRE_en-us.iso \ +# -vnc :10 \ +# -display none \ + +while true; do sleep 999; done