简体   繁体   English

如何制作ubuntu可执行文件并在我的安装文件中运行它

[英]How to make a ubuntu executable and run it in my install file

This is the install file below (sandhi-install.sh). 这是下面的安装文件(sandhi-install.sh)。 Currently after installing it can only be run from the terminal. 目前,安装后只能从终端运行。 I want to make it terminal independent. 我要使其终端独立。 Making a Ubuntu executable explains how to create an executable but where should I put that code. 制作Ubuntu可执行文件说明了如何创建可执行文件,但是我应该将该代码放在哪里。 I think it should be in the install file itself because we want the icon to appear on the desktop after installation completes. 我认为它应该在安装文件中,因为我们希望图标在安装完成后出现在桌面上。 I have no prior experience in Shell scripting and bash so sorry if i miss any important information. 我以前没有Shell脚本和bash方面的经验,所以如果我错过任何重要信息,我们深表歉意。 Please ask if you need any other file. 请询问您是否需要其他文件。 My aim is basically to run sandhi independent of the terminal. 我的目标是基本上独立于终端运行sandhi。

#!/bin/bash

echo "Installing the required dependencies"

sudo apt-get -y install git-core autoconf automake make libtool g++ python-dev swig \
pkg-config libboost1.48-all-dev libfftw3-dev libcppunit-dev libgsl0-dev \
libusb-dev sdcc libsdl1.2-dev python-wxgtk2.8 python-numpy \
python-cheetah python-lxml doxygen python-qt4 python-qwt5-qt4 libxi-dev \
libqt4-opengl-dev libqwt5-qt4-dev libfontconfig1-dev libxrender-dev \
python-serial python-matplotlib

echo "Sciscipy installation starting"
git clone https://github.com/manojgudi/sciscipy-1.0.0.git
cd sciscipy-1.0.0/
sudo ./install

echo "Starting Sandhi installation"
cd ../
git clone http://github.com/manojgudi/sandhi.git
cd sandhi/
git submodule init
git submodule update
git pull origin master
git submodule update

mkdir build
cd build/
cmake ../
make -j 2
sudo make install
sudo ldconfig

echo "Sandhi installation complete. Go to command line and type Sandhi to start Sandhi"

Your script already has all the right ingredients for being a *nix executable - a shebang line and what at least looks like valid code for the interpreter ( /bin/bash ). 您的脚本已经具有成为* nix 可执行文件的所有适当条件-shebang行 ,至少看起来像是解释器的有效代码( /bin/bash )。 All you need to do is to give the relevant user and/or group (or everybody) execute access on the file. 您需要做的就是授予相关用户和/或组(或每个人)对该文件的访问权限。 For example, if you're the owner of the file: 例如,如果您是文件的所有者:

sandhi@host$ ls -l sandhi.sh
-rw-r--r--  1 purak users 3.5K Oct 11 16:55 sandhi.sh
sandhi@host$ chmod u+x sandhi.sh

Now you can execute it: 现在您可以执行它:

sandhi@host$ ls -l sandhi.sh
-rwxr--r--  1 purak users 3.5K Oct 11 16:55 sandhi.sh
sandhi@host$ ./sandhi.sh

For the rest of the question it's unclear what you're asking. 对于其余的问题,不清楚您要问什么。 The accepted answer to Making a Ubuntu executable says that if the executable foo.bin is in /usr/local/bin (a sensible destination for custom executables) the line in the desktop entry should be Exec=/usr/local/bin/foo.bin . 制作Ubuntu可执行文件的公认答案是,如果可执行文件foo.bin位于/usr/local/bin (自定义可执行文件的明智目标)中,则桌面条目中的行应为Exec=/usr/local/bin/foo.bin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM