wiwengweng
wiwengweng

Reputation: 352

error: code install-extension command inside rpm package in OpenEuler(Centos)

I met a funny error. In my case, I have many vscode extension(vsix) files, and I want to build a rpm package with rpmbuild, and then I can install the vsix-s with this rpm package. So I build a hello world spec with this helloworld tutorial. https://www.redhat.com/en/blog/create-rpm-package

Then inside the %post setion, I just add a vscode command line to install an demo vsix file, like this:

%post
/home/user/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/bin/remote-cli/code --install-extension /tmp/soft-realtime-1.0.94.vsix

Then I build the rpm package. I start vscode, and try to install with this rpm pakcage in vscode terminal, but meet an error:

+ /home/user/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/bin/remote-cli/code --install-extension /tmp/soft-realtime-1.0.94.vsix
Command is only available in WSL or inside a Visual Studio Code terminal.

Actually I can build and install the same rpm package in Ubuntu successfully,

wyl@LAPTOP-I0C369CM:~$ rpm -ivh hello-0.1-1.x86_64.rpm --nodeps
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:hello-0.1-1                      ################################# [100%]
Installing extension in WSL: Ubuntu-22.04 …
successfully install “soft-realtime-1.0.94.vsix”。
installation finished!

but not in openEuler. Can someone help? Thanks

p.s. This is the demo spec file.

[user@localhost spec]$ cat helloworld.spec
BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root
Summary:    hello world rpm package
Name:       hello
Version:    0.1
Release:    1
Source:     hello-0.1.tar.gz
License:    GPL
Packager:   wyl
Group:      Application

%define debug_package %{nil}
%define _unpackaged_files_terminate_build 0

%description
This is a simple example for rpm package!

%prep
%setup -q

%build
gcc -o hello hello.c

%install

mkdir -p %{buildroot}/usr/local/bin
#cp thirdp.ko %{buildroot}/usr/local/
#install -m 755 hello %{buildroot}/usr/local/bin/hello
%files
#/usr/local/bin/hello

%post
$HOME/.vscode-server/bin/fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/bin/remote-cli/code --install-extension /tmp/soft-realtime-1.0.94.vsix
echo 'installation finished!'

Upvotes: 0

Views: 16

Answers (0)

Related Questions