Rename .zip file generated by electron packager - electron

Electron-packager generates folder my-app-win32-x64 but I want this file to be only my-app. I want rest to be removed. I understand electron packager generates .zip file. When this is unzipped it retains the same name.
I tried editing index.js under electron-packager. I am not able to understand this .zip file is generated. So that I can edit the name in which elctron-packager generates this file.
Directory structure:
my-app
/scripts
...
...
/win64
/my-app-win32-x64 //this directory name must be just my-app
my-app.exe
/app
Build script:
"build": "electron-packager --out winx64 --overwrite --platform win32 --appname my-app . --icon=./my_logo.ico --executable-name my-app"

I don't understand how this relates to any ZIP file at all. electron-packager creates a directory structure with an executable, folders, etc., but no ZIP file.
Electron-packager creates a directory {out}/{appname}-win32-x64 where {out} and {appname} are the given command line parameters.
Since you want this output directory to have a different name, you could simply rename it after it's created.
Linux/Mac:
"build": "electron-packager ... && mv win64/my-app-win32-x64 win64/my-app"
Windows:
"build": "electron-packager ... && ren win64\my-app-win32-x64 win64\my-app"
The && runs the second command only if the first one completes successfully (non-zero exit code).

Related

"go: go.mod file not found in current directory" but it already exist in the directory

I'm trying to build a DockerFile for a project around GCP.
I'm using go version 1.17 and it fails at the get command saying that go.mod isn't found but it exist in the same directory as the Dockerfile. I already tried go mod init and go mod tidy but I still got the same error. Here are my env variables and my files :
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/name/.cache/go-build"
GOENV="/home/name/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/name/work/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/name/work"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.1"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/name/workspace/professional-services/tools/gcs2bq/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3855548593=/tmp/go-build -gno-record-gcc-switches"
list of the files in my working directory :
name#vm-gcs2bq:~/workspace/professional-services/tools/gcs2bq$ ls
Dockerfile bigquery.schema datastudio.png gcs2bq.avsc go.mod main.go
README.md credentials.json gcs2bq-custom-role.yaml gcs2bq.yaml go.sum run.sh
My working directory in the Dockerfile is correctly set (the gcs2bq one) and when trying to build it I got :
Step 6/16 : RUN go get -v ./...
---> Running in ebaa284887cf
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
I'm still kinda new to go, mostly did c and python and I read that packages are managed in a different way in this language but I think I set my paths correctly too. Correct me if I'm wrong.
Any help is appreciated, ask for more details if you need to.
Thanks in advance !
Okay I solved my problem.
First, my WORKDIR wasn't pointing at the right directory : WORKDIR /go/src/github.com/rosmo/gcs2bq instead of WORKDIR /work/src/github.com/rosmo/gcs2bq but it's only because of me using /work instead of /go for the installed packages.
Then I added the follwing after the COPY main.go . command :
RUN go mod init v1
RUN go mod tidy
Which created the "missing" go.mod file and properly installed the dependencies/packages needed.
The rest of the build went perfectly normal.
Thanks for your help.

Bypass `-C` flag when unzipping tar archive

I have a .tar.gz archive with the following structure:
opt/client/py/utils/mappings/templates/config.json
opt/
opt/mag/
opt/mag/sw/
opt/mag/sw/apps/
opt/mag/sw/apps/service/
opt/mag/etc/
opt/mag/etc/service.environment
opt/mag/etc/service.toml
And this .tar.gz archive is extracted using this command:
tar -zxf ../service.tar.gz -C opt/mag/ --strip-components=2
Thee issue is this will extract the opt/client/py/utils/mappings/templates/config.json file inside opt/mag so it will become: opt/mag/py/utils/mappings/templates/config.json which is obviously wrong. Notice the removal of opt/client/ by --strip-components=2.
The issue is that I cannot change the unzip command
I've tried to hack it around by inserting 2 dummy directories to bypass --strip-components=2 something like this:
dummy1/dummy2/opt/client/py/utils/mappings/templates/config.json
opt/
opt/mag/
opt/mag/sw/
opt/mag/sw/apps/
opt/mag/sw/apps/service/
opt/mag/etc/
opt/mag/etc/service.environment
opt/mag/etc/service.toml
This way --strip-components=2 will remove dummy1/dummy2 and the config file will be extracted to /opt/mag/opt/client/py/utils/mappings/templates/config.json which is still wrong, because that -C opt/mag will force the extraction inside opt/mag.
Given the fact that I cannot change the unzip command is there anyway to bypass the -C switch or some way to hack it around?
Also, I cannot edit or move files on the container where this archive is extracted

Working bin/bas returns error when executed from run script Xcode

I have a working shell script that works with no problems but when I executed it with a run script i get the following error:
The script will scan all the proto files in a directory and convert it to Swift using ProtoBuf. After that I will move the swift files into an App folder. The script code is the following
#!/bin/bash
for protoFile in ./*.proto;
do
protoc --swift_out=. $protoFile
done
for file in ./*.swift;
do
mv $file ../Convert\ AV/Model/USBDongle/Proto/
done
Any ideas?
Thank you
I was calling the script from the directory it was located. When Xcode executes the the script that assumption is false. So I am getting the directory where the script is located and I do the logic with that path
#!/bin/bash
#Get Directory where the script is located
baseDirectory=$(dirname "$0")
echo "$baseDirectory"
for protoFile in "$baseDirectory"/*.proto
do
echo $protoFile
protoc --swift_out="$baseDirectory" -I "$baseDirectory" "$protoFile"
done
for protoFileSwift in "$baseDirectory"/*.swift;
do
echo $protoFile
mv "$protoFileSwift" "$baseDirectory"/../Convert\ AV/Model/USBDongle/Proto
done
* /* Makes like is a comment... *

tar: unable to include folder but exclude content

I have a project folder with several directories
- archive
- include
- lib
- src
- src/obj (obj is a subdirectory of src)
I would like tar to pack these directories and their contents into a main.tar, then I will the main.tar into the archive directory.
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*" \
-f main.tar \
./archive ./include ./lib ./src
I would like to exclude the contents of the archive directory but still package the empty directory itself. You can see I am also excluding some other stuff from various places, OSX likes to write .DS_Store files everywhere on my filesystem and I occasionally make copies of files and append .obsolete to the end while working on a new version.
Unfortunately, the empty archive directory is not included in main.tar.
According to this thread, my command should work.
How can the files be excluded from archive but the empty directory be packed into the tar file?
edit
The following fails:
--exclude="./archive/*"
The following works:
--exclude="./archive/*.*"
So the whole command is:
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*.*" \
-f main.tar \
./archive ./include ./lib ./src

Need to create a folder in remote server usint ant

using ant scp i can able to copy a file from local system(windows) to server(linux).so what i need is i want to create a folder by the system date at specified directory in linux system using ant and copy the file to the folder which created..
this is my ant script:
<sshexec host="hostname:22" username="****" trust="true"
password="fcubs"
command="mkdir $/home/desktop/<folder to be creted here>"/>
<scp todir="username#hostname:/home/desktop" password="*****" trust="true">
<fileset dir="D:\kkk"/>
</scp>
pls help me
thanks in advance
you can use such linux command which creates directory:
export ATD=`date '+%h-%d-%Y_%H:%M:%S'` && cd /path/to/specified/dir && mkdir $ATD && cd $ATD
it will create dir (for example) "Nov-14-2012_17:41:02" in the dir /path/to/specified/dir and will cd to it.
after executing this command you can simply copy your file to the directory.

Resources