⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkginstaller.c

📁 linux的多线程下载工具。基于gtk界面。
💻 C
字号:
/* pkginstaller.c * * Copyright (C) 2004-2004 Wang Xiaoguang (Chice) <chice_wxg@hotmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Authors: Wang Xiaoguang (Chice) <chice_wxg@hotmail.com> */#include "pkginstaller.h"#include "os.h"INT generate_dldinst_script(char *filename){char *dldinst_script ="#!/bin/sh\n""\n""cd /tmp\n""if test ! -r dldinst \n""then\n""    mkdir dldinst\n""fi\n""\n""echo \"\"\n""echo \"\"\n""echo \"+---------------------------------------------------+\"\n""echo \"|                                                   |\"\n""echo \"|         DLD's tar package auto installer          |\"\n""echo \"|                                                   |\"\n""echo \"+---------------------------------------------------+\"\n""\n""echo \"Unpacking the package, please wait for a few minutes ...\"\n""echo \"(Press Ctrl + C to stop the installion.)\"\n""echo \"\"\n""filelist=`$2 -d -c $1 | tar -C /tmp/dldinst -x -v -f -`\n""if [ -z filelist ] \n""then\n""    echo \"Fail to extract the package.\"\n""    echo \"(Press any key to exit.)\"\n""    read -n 1\n""    exit 1\n""fi\n""\n""for packagename in $filelist\n""do\n""	targetdir=\"/tmp/dldinst/$packagename\"\n""	break;\n""done;\n""\n""echo \"Temp directory is : $targetdir\"\n""\n""cd $targetdir\n""\n""if test ! -r Makefile \n""then\n""	if test ! -r configure\n""	then\n""		echo \"\"\n""		echo \"This package doesn't seem to be a GNU standard package.\"\n""		echo \"It can't be configured or made by dldinst.\" \n""		echo \"Please enter the directory '$targetdir' and install it manually.\" \n""       echo \"(Press any key to exit.)\"\n""       read -n 1\n""		exit 0\n""		\n""	else\n""		echo \"\"\n""		echo \"'./configure' will be executed.\"\n""		echo \"If you want to install the package manually, please press Ctrl + C to stop this process.\"\n""		echo \"Press any key to continue...\"\n""		read -n 1\n""		echo \"\"\n""\n""		if ./configure \n""		then\n""			echo \"./configure finished successfully.\"\n""		else\n""			echo \"\"\n""			echo \"==========================================\"\n""			echo \"./configure FAILED!\"\n""			echo \"Please check the output messages.\"\n""			echo \"(If you don't want to re-install the package any more, You had better\nremove the temp directory '$targetdir' manually.)\"\n""           echo \"(Press any key to exit.)\"\n""           read -n 1\n""			exit 1\n""		fi\n""	fi\n""fi\n""\n""echo \"\"\n""echo \"'make install' will be executed.\"\n""echo \"If you want to install the package manually, please press Ctrl + C to stop this process.\"\n""echo \"Press any key to continue...\"\n""read -n 1\n""echo \"\"\n""\n""\n""if make install\n""then\n""	echo \"make install finished successfully.\"\n""else\n""		echo \"\"\n""		echo \"==========================================\"\n""		echo \"make install FAILED!\"\n""		echo \"Please check the output messages.\"\n""		echo \"(If you don't want to re-install the package any more, You had better\nremove the temp directory '$targetdir' manually.)\"\n""       echo \"(Press any key to exit.)\"\n""       read -n 1\n""		exit 1;\n""fi\n""\n""echo \"\"\n""echo \"Next we will clean the temp directory. Press any key to continue...\"\n""echo \"If you do not want to remove the directory, please press Ctrl + C to stop this process.\"\n""read -n 1\n""rm -r $targetdir\n""\n""\n""echo \"The package '$packagename' has been installed successfully.\"\n""echo \"You can get the the directory where the package is installed by finding the keywords 'install' above.\"\n""echo \"Have Fun!\"\n""rm -rf $0";;	FILE *fp;		os_mkdir(filename, TRUE);		if((fp = fopen(filename, "w")) == NULL)		return DLD_ERR_NULLPOINTER;			fwrite(	dldinst_script, strlen(dldinst_script), 1, fp);	fclose(fp);	chmod(filename, 0755);	return DLD_ERR_OK;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -