Let's take a look at the program.

Source: Internet
Author: User
Let's take a look at whether there is a problem with this program-Linux general technology-Linux programming and kernel information. The following is a detailed description. The Code is as follows:
#! /Usr/bin/sh

######################################## ################################

CLIENT_PATH =/opt/client # custom program installation directory

######################################## ################################

Echo
Echo Northwest Agriculture and Forestry University Campus Network linux Client installation script
Echo
Echo: $ USER
Echo user HOME directory: $ HOME
Echo Current Directory: $ PWD
Echo default program installation directory: $ CLIENT_PATH
Echo

# Check the integrity of the program file
If [-d glade] & [-d png] & [-f client];
Then

# Modifying the program startup path in the run. sh File
Echo gksudo $ CLIENT_PATH/client> run. sh

# Start the installation process
Does echo-n start installation? (Y/N ):
Read ok1

{[$ Ok1! = Y] & [$ ok1! = Y] ;}& & {
Echo to exit installation!
Exit;
}

{[$ Ok1 = Y] | [$ ok1 = y] ;}& & {
# ------ If the specified installation directory already exists
[-D $ CLIENT_PATH] & {
Echo-n has a specified installation directory, and whether to reinstall (Y/N ):
Read ok2
Sudo echo # enable root permission
{[$ Ok2! = Y] & [$ ok2! = Y] ;}& & {
Echo to exit installation!
Exit;
}
{[$ Ok2 = Y] | [$ ok2 = y] ;}& & {
Sudo rm-r $ CLIENT_PATH
Echo create installation folder $ CLIENT_PATH
Sudo mkdir-p $ CLIENT_PATH
Echo: copy the file to the installation folder.
Sudo cp-rf./* $ CLIENT_PATH
}
}
# ------ If the specified installation directory does not exist
[-D $ CLIENT_PATH] | {
Echo create installation folder $ CLIENT_PATH
Sudo mkdir-p $ CLIENT_PATH
Echo: copy the file to the installation folder.
Sudo cp-rf./* $ CLIENT_PATH
}
}

# Check whether the required library files exist in the system and perform corresponding operations
If find/usr/lib-name libnet. so.1>/dev/null & find/usr/lib-name libpcap. so.0.8>/dev/null; then
Echo ""
Else {
Copy the file to the/usr/lib directory using echo.
Sudo cp-f./lib/libnet. so.1/usr/lib
Sudo cp-f./lib/libpcap. so.0.8/usr/lib
}
Fi;

# Check whether the/opt/client/glade/client. glade file exists and perform corresponding operations

[-F/opt/client/glade/client. glade] | {sudo mkdir-p/opt/client/glade; sudo cp glade/client. glade/opt/client/glade /;}

# Program file owner and permission settings
Echo changes the owner of the program installation directory to $ USER
Sudo chown-R $ USER $ CLIENT_PATH
Echo adds executable permissions to the client of the logon program to all users.
Sudo chmod a + x $ CLIENT_PATH/client
Sudo chmod a + x $ CLIENT_PATH/run. sh

# Create a program to the desktop starter
Echo creates the 'login project' to the desktop Initiator
[-D ~ /Desktop] & {
Cp-f NetClient ~ /Desktop/Client. desktop
Echo Exec = $ CLIENT_PATH/run. sh> ~ /Desktop/Client. desktop
Echo Icon = $ CLIENT_PATH/png/client.png> ~ /Desktop/Client. desktop
}
[-D ~ /Desktop] & {
Cp-f NetClient ~ /Desktop/Client. desktop
Echo Exec = $ CLIENT_PATH/run. sh> ~ /Desktop/Client. desktop
Echo Icon = $ CLIENT_PATH/png/client.png> ~ /Desktop/Client. desktop
}

# Complete installation
Echo
Echo Installation complete!

# The installation is canceled because the required files (folders) are lost
Else
The echo program file is lost or the script is not placed in the program directory. The operation cannot be performed!
Fi;
Experts can help you to see if there is any problem. I can't install it all the time ,,,
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.