mirror of
https://github.com/tsingui/softcenter-1.git
synced 2024-11-14 09:55:17 +00:00
add swap
This commit is contained in:
parent
cad92e599d
commit
29acb454c6
@ -11,9 +11,14 @@
|
||||
"version": "0.2.3"
|
||||
},
|
||||
{
|
||||
"build_date": "2018-12-08_00:04:35",
|
||||
"description": "shadowsocks",
|
||||
"home_url": "Main_Ss_Content.asp",
|
||||
"md5": "cf64c5749a42228b932f8568e9f563e9",
|
||||
"name": "shadowsocks",
|
||||
"tar_url": "shadowsocks/shadowsocks.tar.gz",
|
||||
"title": "shadowsocks"
|
||||
"title": "shadowsocks",
|
||||
"version": "3.0.4"
|
||||
},
|
||||
{
|
||||
"build_date": "2017-05-03_19:15:58",
|
||||
@ -27,14 +32,14 @@
|
||||
"version": "1.0.0"
|
||||
},
|
||||
{
|
||||
"build_date": "2016-09-01_17:21:04",
|
||||
"build_date": "2019-01-12_19:22:11",
|
||||
"description": "老板,来一斤虚拟内存~",
|
||||
"home_url": "Module_swap.asp",
|
||||
"md5": "852a398f732af3508c83a6d3ca91f25d",
|
||||
"md5": "4ea389360d37f7ff9d2d4046b43be59b",
|
||||
"name": "swap",
|
||||
"tar_url": "swap/swap.tar.gz",
|
||||
"title": "虚拟内存",
|
||||
"version": "1.8"
|
||||
"version": "2.2"
|
||||
},
|
||||
{
|
||||
"build_date": "2017-06-06_01:02:58",
|
||||
@ -87,21 +92,6 @@
|
||||
"title": "DDnspod",
|
||||
"version": "0.1.3"
|
||||
},
|
||||
{
|
||||
"name": "tunnel",
|
||||
"tar_url": "tunnel/tunnel.tar.gz",
|
||||
"title": "tunnel"
|
||||
},
|
||||
{
|
||||
"build_date": "2016-09-01_17:20:46",
|
||||
"description": "让分流更简单",
|
||||
"home_url": "Module_policy_route.asp",
|
||||
"md5": "3112c34fa479156b5872ae700b7015b3",
|
||||
"name": "dualwan",
|
||||
"tar_url": "dualwan/dualwan.tar.gz",
|
||||
"title": "策略路由",
|
||||
"version": "0.6"
|
||||
},
|
||||
{
|
||||
"build_date": "2016-09-16_10:11:21",
|
||||
"description": "广告屏蔽大师",
|
||||
@ -114,7 +104,7 @@
|
||||
}
|
||||
],
|
||||
"home_url": "https://raw.githubusercontent.com/paldier/softcenter/master",
|
||||
"md5": "3242715f2a71bec3ffc70252f92c977b",
|
||||
"md5": "3bb44fca41795904e2490e728c7138ed",
|
||||
"tar_url": "softcenter/softcenter.tar.gz",
|
||||
"version": "1.1.6"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"version":"1.1.6",
|
||||
"md5":"3242715f2a71bec3ffc70252f92c977b"
|
||||
"md5":"3bb44fca41795904e2490e728c7138ed"
|
||||
}
|
||||
|
Binary file not shown.
BIN
softcenter/softcenter/bin/perpboot
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpboot
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perpctl
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpctl
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perpd
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpd
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perphup
Normal file → Executable file
BIN
softcenter/softcenter/bin/perphup
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perpls
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpls
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perpok
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpok
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/perpstat
Normal file → Executable file
BIN
softcenter/softcenter/bin/perpstat
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/sissylog
Normal file → Executable file
BIN
softcenter/softcenter/bin/sissylog
Normal file → Executable file
Binary file not shown.
BIN
softcenter/softcenter/bin/tinylog
Normal file → Executable file
BIN
softcenter/softcenter/bin/tinylog
Normal file → Executable file
Binary file not shown.
@ -11,10 +11,9 @@ softcenter_install() {
|
||||
chmod 755 /jffs/softcenter/perp/*
|
||||
chmod 755 /jffs/softcenter/perp/.boot/*
|
||||
chmod 755 /jffs/softcenter/perp/.control/*
|
||||
chmod 755 /jffs/softcenter/perp/adm/*
|
||||
rm -rf /tmp/softcenter
|
||||
if [ ! -f "/jffs/softcenter/init.d/S10Softcenter.sh" ]; then
|
||||
ln -sf /jffs/softcenter/scripts/app_install.sh /jffs/softcenter/init.d/S10Softcenter.sh
|
||||
ln -sf /jffs/softcenter/scripts/ks_app_install.sh /jffs/softcenter/init.d/S10Softcenter.sh
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
if test ${1} = 'start' ; then
|
||||
exec tinylog -k 5 -t /var/log/${2}
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
adm_enable=`dbus get adm_enable`
|
||||
exec 2>&1
|
||||
if test ${1} = 'start' ; then
|
||||
if [ "$adm_enable" == "1" ];then
|
||||
exec /jffs/softcenter/adm/ADM
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
export PERP_BASE=/koolshare/perp
|
||||
export PERP_BASE=/jffs/softcenter/perp
|
||||
|
||||
case $ACTION in
|
||||
start)
|
||||
|
@ -231,12 +231,15 @@ uninstall_module() {
|
||||
rm -f /jffs/softcenter/webs/Module_$softcenter_installing_todo.asp
|
||||
rm -f /jffs/softcenter/init.d/S*$softcenter_installing_todo.sh
|
||||
fi
|
||||
curl -s http://sc.paldier.com/"$softcenter_installing_module"/"$softcenter_installing_module"/install.sh >/dev/null 2>&1
|
||||
}
|
||||
|
||||
LOGGER $BIN_NAME
|
||||
#LOGGER $BIN_NAME
|
||||
case $BIN_NAME in
|
||||
start)
|
||||
sh /jffs/softcenter/perp/perp.sh stop
|
||||
sh /jffs/softcenter/perp/perp.sh start
|
||||
dbus set softcenter_installing_status=1
|
||||
;;
|
||||
update)
|
||||
install_module
|
||||
|
@ -20,6 +20,7 @@
|
||||
<script type="text/javascript" src="/general.js"></script>
|
||||
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
||||
<script type="text/javascript" src="/form.js"></script>
|
||||
<script type="text/javascript" src="/dbconf?p=softcenter_&v=<% uptime(); %>"></script>
|
||||
<style>
|
||||
.cloud_main_radius_left{
|
||||
-webkit-border-radius: 10px 0 0 10px;
|
||||
@ -121,7 +122,6 @@
|
||||
bottom: 0;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.icon-desc .uninstall-btn{
|
||||
display: none;
|
||||
}
|
||||
@ -207,7 +207,6 @@
|
||||
.cloud_main_radius h5 { color:#FFF;font-weight:normal;font-style: normal;}
|
||||
</style>
|
||||
<script>
|
||||
var db_softcenter_ = {};
|
||||
//set tabstop=4 set shiftwidth=4 set expandtab
|
||||
String.prototype.format = String.prototype.f = function() {
|
||||
var s = this,
|
||||
@ -237,7 +236,6 @@ function checkField(o, f, d) {
|
||||
if(typeof o[f] == "undefined") {
|
||||
o[f] = d;
|
||||
}
|
||||
|
||||
return o[f];
|
||||
}
|
||||
function appPostScript(moduleInfo, script) {
|
||||
@ -246,7 +244,7 @@ function appPostScript(moduleInfo, script) {
|
||||
return;
|
||||
}
|
||||
//Current page must has prefix of "Module_"
|
||||
var data = {"SystemCmd":script, "current_page":"Module_koolnet.asp", "action_mode":" Refresh ", "action_script":""};
|
||||
var data = {"action_script":script, "current_page":"Module_koolnet.asp", "action_mode":" Refresh "};
|
||||
|
||||
var applyUrl = "applydb.cgi?p=softcenter_";
|
||||
|
||||
@ -258,12 +256,10 @@ function appPostScript(moduleInfo, script) {
|
||||
data["softcenter_installing_tar_url"] = moduleInfo.tar_url;
|
||||
data["softcenter_installing_md5"] = moduleInfo.md5;
|
||||
data["softcenter_installing_version"] = moduleInfo.version;
|
||||
|
||||
//Update title for this module
|
||||
data[moduleInfo.name + "_title"] = moduleInfo.title;
|
||||
applyUrl = applyUrl + "," + moduleInfo.name;
|
||||
//applyUrl = applyUrl + "," + moduleInfo.name;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: applyUrl,
|
||||
@ -286,7 +282,6 @@ function appInstallModule(moduleInfo) {
|
||||
appPostScript(moduleInfo, "ks_app_install.sh");
|
||||
}
|
||||
function appUninstallModule(moduleInfo) {
|
||||
|
||||
if (!window.confirm('确定卸载吗')) {
|
||||
return;
|
||||
}
|
||||
@ -338,7 +333,6 @@ function appUninstallModule(moduleInfo) {
|
||||
if(o[base+"status"] != currState.lastStatus) {
|
||||
currState.lastStatus = o[base+"status"];
|
||||
showInstallInfo(curr_module, currState.lastStatus);
|
||||
|
||||
// Install ok now
|
||||
if(currState.lastStatus == "1" || currState.lastStatus == "7") {
|
||||
currState.installing = false;
|
||||
@ -358,7 +352,6 @@ function appUninstallModule(moduleInfo) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function showInstallInfo(module, scode) {
|
||||
var code = parseInt(scode);
|
||||
var s = module.capitalizeFirstLetter();
|
||||
@ -397,7 +390,6 @@ function appUninstallModule(moduleInfo) {
|
||||
// set apps to global variable of softInfo
|
||||
softInfo = apps;
|
||||
//console.log(softInfo);
|
||||
|
||||
//简单模板函数
|
||||
function _format(source, opts) {
|
||||
var source = source.valueOf(),
|
||||
@ -428,7 +420,7 @@ function appUninstallModule(moduleInfo) {
|
||||
'</dd>',
|
||||
'<dt class="icon-title">#{title}</dt>',
|
||||
'<dd class="icon-desc">',
|
||||
'<a class="text" href="/#{home_url}" #{target}>',
|
||||
'<a class="text" href="/#{home_url}">',
|
||||
'#{description}',
|
||||
'</a>',
|
||||
'<div class="opt">',
|
||||
@ -615,7 +607,7 @@ function softceterInitData(data) {
|
||||
|
||||
});
|
||||
|
||||
function menu_hook() {
|
||||
function menu_hook(title, tab) {
|
||||
tabtitle[tabtitle.length -1] = new Array("", "软件中心", "离线安装");
|
||||
tablink[tablink.length -1] = new Array("", "Main_Soft_center.asp", "Main_Soft_setting.asp");
|
||||
}
|
||||
@ -736,7 +728,7 @@ function notice_show(){
|
||||
|
||||
<tr bgcolor="#444f53" width="235px">
|
||||
<td colspan="4" id="IconContainer">
|
||||
<div id="software_center_message" style="text-align:center; line-height: 4em;">更新中...</div>
|
||||
<div style="text-align:center; line-height: 4em;">更新中...</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height="10px">
|
||||
@ -748,6 +740,7 @@ function notice_show(){
|
||||
<br/>Github项目: <a href="https://github.com/koolshare/koolshare.github.io" target="_blank"> <i><u>github.com/koolshare</u></i> </a>
|
||||
<br/>Powered by: <i>koolshare开发组</i>
|
||||
<br/>修改版 by: <i>paldier</i>
|
||||
<br/>Github项目: <a href="https://github.com/paldier/softcenter" target="_blank"> <i><u>https://github.com/paldier</u></i> </a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,2 +1,2 @@
|
||||
1.1.6
|
||||
3242715f2a71bec3ffc70252f92c977b
|
||||
3bb44fca41795904e2490e728c7138ed
|
||||
|
24
swap/backup.sh
Normal file
24
swap/backup.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#! /bin/sh
|
||||
|
||||
# you can do something here
|
||||
# this shell scripts will run at the end of build.py scripts
|
||||
|
||||
tar_name="$1.tar.gz"
|
||||
|
||||
mkdir -p history
|
||||
if [ ! -f ./history/version ];then
|
||||
touch ./history/version
|
||||
fi
|
||||
|
||||
version_old=`cat history/version | awk '{print $1}' | sort -rn |sed -n 1p`
|
||||
version_new=`cat config.json.js |grep "version"|cut -d"\"" -f 4`
|
||||
md5_old=`cat history/version | sort -nk1 | awk '{print $1}' |sed -n 1p`
|
||||
md5_new=` md5sum $tar_name | awk '{print $1}'`
|
||||
|
||||
if [ -f ./$tar_name ];then
|
||||
if [ "$version_old" != "$version_new" ];then
|
||||
mkdir ./history/$version_new/
|
||||
cp ./$tar_name ./history/$version_new/
|
||||
echo $version_new $md5_new >> ./history/version
|
||||
fi
|
||||
fi
|
32
swap/build.sh
Executable file
32
swap/build.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
MODULE=swap
|
||||
VERSION=2.2
|
||||
TITLE=虚拟内存
|
||||
DESCRIPTION=老板,来一斤虚拟内存~
|
||||
HOME_URL=Module_swap.asp
|
||||
|
||||
# Check and include base
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ "$MODULE" == "" ]; then
|
||||
echo "module not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then
|
||||
echo "install script not found"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# now include build_base.sh
|
||||
. $DIR/../softcenter/build_base.sh
|
||||
|
||||
# change to module directory
|
||||
cd $DIR
|
||||
|
||||
# do something here
|
||||
|
||||
do_build_result
|
||||
|
||||
sh backup.sh $MODULE
|
8
swap/config.json.js
Normal file
8
swap/config.json.js
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":"2.2",
|
||||
"md5":"4ea389360d37f7ff9d2d4046b43be59b",
|
||||
"home_url":"Module_swap.asp",
|
||||
"title":"虚拟内存",
|
||||
"description":"老板,来一斤虚拟内存~",
|
||||
"build_date":"2019-01-12_19:22:11"
|
||||
}
|
BIN
swap/history/2.2/swap.tar.gz
Normal file
BIN
swap/history/2.2/swap.tar.gz
Normal file
Binary file not shown.
1
swap/history/version
Normal file
1
swap/history/version
Normal file
@ -0,0 +1 @@
|
||||
2.2 4ea389360d37f7ff9d2d4046b43be59b
|
BIN
swap/swap.tar.gz
Normal file
BIN
swap/swap.tar.gz
Normal file
Binary file not shown.
13
swap/swap/install.sh
Executable file
13
swap/swap/install.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
cd /tmp
|
||||
cp -rf /tmp/swap/swap /jffs/softcenter/
|
||||
cp -rf /tmp/swap/scripts/* /jffs/softcenter/scripts/
|
||||
cp -rf /tmp/swap/webs/* /jffs/softcenter/webs/
|
||||
cp -rf /tmp/swap/res/* /jffs/softcenter/res/
|
||||
cd /
|
||||
rm -rf /tmp/swap* >/dev/null 2>&1
|
||||
|
||||
|
||||
chmod 755 /jffs/softcenter/swap/*
|
||||
chmod 755 /jffs/softcenter/scripts/swap*
|
||||
|
BIN
swap/swap/res/icon-swap.png
Normal file
BIN
swap/swap/res/icon-swap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
3
swap/swap/scripts/swap_check.sh
Executable file
3
swap/swap/scripts/swap_check.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
sh /jffs/softcenter/swap/swap.sh check
|
3
swap/swap/scripts/swap_load.sh
Executable file
3
swap/swap/scripts/swap_load.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
sh /jffs/softcenter/swap/swap.sh load
|
14
swap/swap/scripts/swap_startup.sh
Executable file
14
swap/swap/scripts/swap_startup.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#! /bin/sh
|
||||
# ====================================变量定义====================================
|
||||
eval `dbus export swap`
|
||||
|
||||
usb_disk=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f3`
|
||||
|
||||
sleep 2
|
||||
if [ -f $usb_disk/swapfile ]
|
||||
then
|
||||
echo -e "Mounting swap file..."
|
||||
swapon $usb_disk/swapswapfile
|
||||
else
|
||||
echo -e "Swap file not found or $usb_disk is not mounted..."
|
||||
fi
|
3
swap/swap/scripts/swap_unload.sh
Executable file
3
swap/swap/scripts/swap_unload.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
sh /jffs/softcenter/swap/swap.sh unload
|
101
swap/swap/swap/swap.sh
Executable file
101
swap/swap/swap/swap.sh
Executable file
@ -0,0 +1,101 @@
|
||||
#! /bin/sh
|
||||
# ====================================变量定义====================================
|
||||
# 版本号定义
|
||||
version="1.8"
|
||||
dbus set swap_version="$version"
|
||||
# 导入skipd数据
|
||||
eval `dbus export swap`
|
||||
|
||||
# 引用环境变量等
|
||||
source /jffs/softcenter/scripts/base.sh
|
||||
|
||||
check_usb_status(){
|
||||
|
||||
# 1 没有找到可用的USB磁盘
|
||||
# 2 USB磁盘格式不符合要求
|
||||
# 3 成功检测到ext?格式磁盘,可以创建swap
|
||||
# 4 swap分区已经加载
|
||||
|
||||
ext_type=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f5`
|
||||
usb_disk=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f3`
|
||||
swapon=`free | grep Swap | awk '{print $2}'`
|
||||
dbus set swap_usb_type="$ext_type"
|
||||
dbus set swap_usb_disk="$usb_disk"
|
||||
|
||||
if [ "$swapon" == "0" ];then
|
||||
if [ -z "$usb_disk" ];then
|
||||
dbus set swap_warnning="1"
|
||||
else
|
||||
if [ -f "$usb_disk"/swapfile ];then
|
||||
swapon "$usb_disk"/swapfile
|
||||
dbus set swap_warnning="4"
|
||||
else
|
||||
if [ "$ext_type" == "ext2" ] || [ "$ext_type" == "ext3" ] || [ "$ext_type" == "ext4" ];then
|
||||
dbus set swap_warnning="3"
|
||||
else
|
||||
dbus set swap_warnning="2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
dbus set swap_warnning="4"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
mkswap(){
|
||||
if [ "$swap_warnning" == "3" ];then
|
||||
[ "$swap_size" == "1" ] && size=256144
|
||||
[ "$swap_size" == "2" ] && size=524288
|
||||
[ "$swap_size" == "3" ] && size=1048576
|
||||
if [ ! -f $usb_disk/swap ];then
|
||||
dd if=/dev/zero of=$usb_disk/swapfile bs=1024 count="$size"
|
||||
/sbin/mkswap $usb_disk/swapfile
|
||||
chmod 0600 $usb_disk/swapfile
|
||||
swapon $usb_disk/swapfile
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
swap_load_start(){
|
||||
if [ -f /jffs/scripts/post-mount ]; then
|
||||
startswap=$(cat /jffs/scripts/post-mount | grep "swap_load" |wc -l)
|
||||
if [ "$startswap" != "1" ];then
|
||||
echo "#! /bin/sh" > /jffs/scripts/post-mount
|
||||
echo " " >> /jffs/scripts/post-mount
|
||||
sed -i '$a\sh\ \/jffs/softcenter/scripts/swap_load.sh' /jffs/scripts/post-mount
|
||||
else
|
||||
echo already set start up for swap load
|
||||
fi
|
||||
else
|
||||
echo "#! /bin/sh" > /jffs/scripts/post-mount
|
||||
echo " " >> /jffs/scripts/post-mount
|
||||
sed -i '$a\sh\ \/jffs/softcenter/scripts/swap_load.sh' /jffs/scripts/post-mount
|
||||
fi
|
||||
chmod +x /jffs/scripts/post-mount
|
||||
}
|
||||
|
||||
swap_unload_start(){
|
||||
sed -i '/swap_load/d' /jffs/scripts/post-mount >/dev/null 2>&1
|
||||
}
|
||||
|
||||
case $ACTION in
|
||||
start)
|
||||
check_usb_status
|
||||
;;
|
||||
load)
|
||||
check_usb_status
|
||||
mkswap
|
||||
swap_load_start
|
||||
;;
|
||||
unload)
|
||||
usb_disk=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f3`
|
||||
swapoff $usb_disk/swapfile
|
||||
rm -rf $usb_disk/swapfile
|
||||
swap_unload_start
|
||||
;;
|
||||
check)
|
||||
check_usb_status
|
||||
swap_load_start
|
||||
;;
|
||||
esac
|
335
swap/swap/webs/Module_swap.asp
Normal file
335
swap/swap/webs/Module_swap.asp
Normal file
@ -0,0 +1,335 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
|
||||
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
|
||||
<link rel="shortcut icon" href="images/favicon.png"/>
|
||||
<link rel="icon" href="images/favicon.png"/>
|
||||
<title>软件中心 - 虚拟内存</title>
|
||||
<link rel="stylesheet" type="text/css" href="index_style.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="form_style.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="usp_style.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="ParentalControl.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/icon.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/element.css">
|
||||
<script type="text/javascript" src="/state.js"></script>
|
||||
<script type="text/javascript" src="/popup.js"></script>
|
||||
<script type="text/javascript" src="/help.js"></script>
|
||||
<script type="text/javascript" src="/validator.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="/general.js"></script>
|
||||
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
|
||||
<script type="text/javascript" src="/dbconf?p=swap_&v=<% uptime(); %>"></script>
|
||||
<script type="text/javascript" src="/res/softcenter.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="/client_function.js"></script>
|
||||
<style>
|
||||
.Bar_container{
|
||||
width:85%;
|
||||
height:20px;
|
||||
border:1px inset #999;
|
||||
margin:0 auto;
|
||||
margin-top:20px \9;
|
||||
background-color:#FFFFFF;
|
||||
z-index:100;
|
||||
}
|
||||
#proceeding_img_text{
|
||||
position:absolute;
|
||||
z-index:101;
|
||||
font-size:11px; color:#000000;
|
||||
line-height:21px;
|
||||
width: 83%;
|
||||
}
|
||||
#proceeding_img{
|
||||
height:21px;
|
||||
background:#C0D1D3 url(/images/ss_proceding.gif);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function init() {
|
||||
show_menu();
|
||||
write_usb_status();
|
||||
check_usb();
|
||||
setTimeout("write_usb_status()", 200);
|
||||
}
|
||||
function applyRule() {
|
||||
document.form.action_mode.value = ' Refresh ';
|
||||
var mode = document.getElementById("swap_size").value;
|
||||
if (mode == "1"){
|
||||
show_swap_LoadingBar(20);
|
||||
} else if (mode == "2"){
|
||||
show_swap_LoadingBar(40);
|
||||
} else if (mode == "3"){
|
||||
show_swap_LoadingBar(80);
|
||||
}
|
||||
document.form.action_script.value = "swap_load.sh";
|
||||
document.form.submit();
|
||||
}
|
||||
function check_usb(){
|
||||
document.form.action_mode.value = ' Refresh ';
|
||||
document.form.action_script.value = "swap_check.sh";
|
||||
document.form.submit();
|
||||
}
|
||||
function unload_swap(){
|
||||
document.form.action_mode.value = ' Refresh ';
|
||||
document.form.action_script.value = "swap_unload.sh";
|
||||
showLoading(5);
|
||||
refreshpage(5);
|
||||
document.form.submit();
|
||||
}
|
||||
function write_usb_status(){
|
||||
$j.ajax({
|
||||
type: "get",
|
||||
url: "dbconf?p=swap_",
|
||||
dataType: "script",
|
||||
success: function() {
|
||||
var usb_type = db_swap_['swap_usb_type'];
|
||||
var usb_path = db_swap_['swap_usb_disk'];
|
||||
if(typeof db_swap_['swap_warnning'] == "undefined" ){
|
||||
$j("#warn").html("<i>正在检查USB磁盘..</i>");$j("#warn").html("<i>正在检查USB磁盘..</i>");
|
||||
document.getElementById('cmdBtn').style.display = "none";
|
||||
document.getElementById('cmdBtn1').style.display = "";
|
||||
}else{
|
||||
if(db_swap_['swap_warnning'] == "1" ){
|
||||
$j("#warn").html("<i>没有找到可用的USB磁盘!</i>");
|
||||
document.getElementById('cmdBtn').style.display = "none";
|
||||
document.getElementById('cmdBtn1').style.display = "";
|
||||
}else if(db_swap_['swap_warnning'] == "2" ){
|
||||
$j("#warn").html("<i>USB磁盘"+usb_type+"格式不符合要求!</i>");
|
||||
document.getElementById('cmdBtn').style.display = "none";
|
||||
document.getElementById('cmdBtn1').style.display = "";
|
||||
}else if(db_swap_['swap_warnning'] == "3" ){
|
||||
$j("#warn").html("<i>检测到"+usb_type+"格式磁盘"+usb_path+",可以创建虚拟内存!</i>");
|
||||
document.getElementById('cmdBtn').style.display = "";
|
||||
document.getElementById('cmdBtn1').style.display = "none";
|
||||
document.getElementById('swap_size_tr').style.display = "";
|
||||
document.getElementById('swap_usage_tr').style.display = "none";
|
||||
}else if(db_swap_['swap_warnning'] == "4" ){
|
||||
$j("#warn").html("<i>已经挂载虚拟内存! 虚拟文件:"+usb_path+"/swapfile</i>");
|
||||
document.getElementById('cmdBtn').style.display = "none";
|
||||
document.getElementById('cmdBtn1').style.display = "";
|
||||
document.getElementById('swap_size_tr').style.display = "none";
|
||||
document.getElementById('swap_usage_tr').style.display = "";
|
||||
}
|
||||
}
|
||||
setTimeout("write_usb_status()", 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
function conf2obj(){
|
||||
$j.ajax({
|
||||
type: "get",
|
||||
url: "dbconf?p=swap_",
|
||||
dataType: "script",
|
||||
success: function(xhr) {
|
||||
var p = "swap_";
|
||||
var params = ["size"];
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
if (typeof db_swap_[p + params[i]] !== "undefined") {
|
||||
$j("#swap_"+params[i]).val(db_swap_[p + params[i]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function show_swap_LoadingBar(seconds){
|
||||
if(window.scrollTo)
|
||||
window.scrollTo(0,0);
|
||||
disableCheckChangedStatus();
|
||||
|
||||
htmlbodyforIE = document.getElementsByTagName("html"); //this both for IE&FF, use "html" but not "body" because <!DOCTYPE html PUBLIC.......>
|
||||
htmlbodyforIE[0].style.overflow = "hidden"; //hidden the Y-scrollbar for preventing from user scroll it.
|
||||
|
||||
winW_H();
|
||||
var blockmarginTop;
|
||||
var blockmarginLeft;
|
||||
if (window.innerWidth)
|
||||
winWidth = window.innerWidth;
|
||||
else if ((document.body) && (document.body.clientWidth))
|
||||
winWidth = document.body.clientWidth;
|
||||
|
||||
if (window.innerHeight)
|
||||
winHeight = window.innerHeight;
|
||||
else if ((document.body) && (document.body.clientHeight))
|
||||
winHeight = document.body.clientHeight;
|
||||
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth){
|
||||
winHeight = document.documentElement.clientHeight;
|
||||
winWidth = document.documentElement.clientWidth;
|
||||
}
|
||||
if(winWidth >1050){
|
||||
|
||||
winPadding = (winWidth-1050)/2;
|
||||
winWidth = 1105;
|
||||
blockmarginLeft= (winWidth*0.3)+winPadding;
|
||||
}
|
||||
else if(winWidth <=1050){
|
||||
blockmarginLeft= (winWidth)*0.3+document.body.scrollLeft;
|
||||
}
|
||||
|
||||
if(winHeight >660)
|
||||
winHeight = 660;
|
||||
|
||||
blockmarginTop= winHeight*0.3
|
||||
|
||||
document.getElementById("loadingBarBlock").style.marginTop = blockmarginTop+"px";
|
||||
// marked by Jerry 2012.11.14 using CSS to decide the margin
|
||||
document.getElementById("loadingBarBlock").style.marginLeft = blockmarginLeft+"px";
|
||||
|
||||
/*blockmarginTop = document.documentElement.scrollTop + 200;
|
||||
document.getElementById("loadingBarBlock").style.marginTop = blockmarginTop+"px";*/
|
||||
document.getElementById("LoadingBar").style.width = winW+"px";
|
||||
document.getElementById("LoadingBar").style.height = winH+"px";
|
||||
|
||||
loadingSeconds = seconds;
|
||||
progress = 100/loadingSeconds;
|
||||
y = 0;
|
||||
LoadingProgress(seconds);
|
||||
}
|
||||
function LoadingProgress(seconds){
|
||||
document.getElementById("LoadingBar").style.visibility = "visible";
|
||||
document.getElementById("loading_block3").innerHTML = "正在设置虚拟内存 ..."
|
||||
$j("#loading_block2").html("<li><font color='#ffcc00'>设置虚拟内存需要较长时间,请耐心等待</font></li>");
|
||||
y = y + progress;
|
||||
if(typeof(seconds) == "number" && seconds >= 0){
|
||||
if(seconds != 0){
|
||||
document.getElementById("proceeding_img").style.width = Math.round(y) + "%";
|
||||
document.getElementById("proceeding_img_text").innerHTML = Math.round(y) + "%";
|
||||
|
||||
if(document.getElementById("loading_block1")){
|
||||
document.getElementById("proceeding_img_text").style.width = document.getElementById("loading_block1").clientWidth;
|
||||
document.getElementById("proceeding_img_text").style.marginLeft = "175px";
|
||||
}
|
||||
--seconds;
|
||||
setTimeout("LoadingProgress("+seconds+");", 1000);
|
||||
}
|
||||
else{
|
||||
document.getElementById("proceeding_img_text").innerHTML = "完成";
|
||||
y = 0;
|
||||
setTimeout("hideLoadingBar();",1000);
|
||||
refreshpage()
|
||||
}
|
||||
}
|
||||
}
|
||||
function hideSSLoadingBar(){
|
||||
document.getElementById("LoadingBar").style.visibility = "hidden";
|
||||
}
|
||||
function reload_Soft_Center(){
|
||||
location.href = "/Main_Soft_center.asp";
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
<div id="TopBanner"></div>
|
||||
<div id="Loading" class="popup_bg"></div>
|
||||
<div id="LoadingBar" class="popup_bar_bg">
|
||||
<table cellpadding="5" cellspacing="0" id="loadingBarBlock" class="loadingBarBlock" align="center">
|
||||
<tr>
|
||||
<td height="100">
|
||||
<div id="loading_block3" style="margin:10px auto;width:85%; font-size:12pt;"></div>
|
||||
<div id="loading_block1" class="Bar_container">
|
||||
<span id="proceeding_img_text"></span>
|
||||
<div id="proceeding_img"></div>
|
||||
</div>
|
||||
|
||||
<div id="loading_block2" style="margin:10px auto; width:85%;">此期间请勿访问屏蔽网址,以免污染DNS进入缓存</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
|
||||
<form method="POST" name="form" action="/applydb.cgi?p=swap_" target="hidden_frame">
|
||||
<input type="hidden" name="current_page" value="Module_swap.asp"/>
|
||||
<input type="hidden" name="next_page" value="Module_swap.asp"/>
|
||||
<input type="hidden" name="group_id" value=""/>
|
||||
<input type="hidden" name="modified" value="0"/>
|
||||
<input type="hidden" name="action_mode" value=""/>
|
||||
<input type="hidden" name="action_script" value=""/>
|
||||
<input type="hidden" name="action_wait" value=""/>
|
||||
<input type="hidden" name="first_time" value=""/>
|
||||
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>"/>
|
||||
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>"/>
|
||||
<table class="content" align="center" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="17"> </td>
|
||||
<td valign="top" width="202">
|
||||
<div id="mainMenu"></div>
|
||||
<div id="subMenu"></div>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<div id="tabMenu" class="submenuBlock"></div>
|
||||
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="left" valign="top">
|
||||
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
|
||||
<tr>
|
||||
<td bgcolor="#4D595D" colspan="3" valign="top">
|
||||
<div> </div>
|
||||
<div style="float:left;" class="formfonttitle">虚拟内存</div>
|
||||
<div style="float:right; width:15px; height:25px;margin-top:10px"><img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img></div>
|
||||
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
|
||||
<div class="formfontdesc" style="padding-top:5px;margin-top:0px;float: left;" id="cmdDesc">创建虚拟内存,让路由运行更顺畅</div>
|
||||
<div id="swap_version_status" style="padding-top:5px;margin-left:30px;margin-right:0px;margin-top:0px;float: left;"><i>当前版本:<% dbus_get_def("swap_version", "0"); %></i></div>
|
||||
<div style="padding-top:5px;margin-top:25px;margin-left:-300px;float: left;" id="NoteBox" >
|
||||
<li style="margin-top:5px;">创建虚拟内存,你需要一个空的、已经格式化成ext2|3|4格式的U盘; </li>
|
||||
<li style="margin-top:5px;">如果你通过其它方式创建了虚拟内存,可以不用使用该工具,或者删除后再使用本工具。</li>
|
||||
<li style="margin-top:5px;">建议使用游戏模式V2,aria2等应用的用户开启虚拟内存!</li>
|
||||
</div>
|
||||
|
||||
<div class="formfontdesc" id="cmdDesc"></div>
|
||||
<table style="margin:10px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable" id="routing_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="2">创建虚拟内存</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr id="swap_status">
|
||||
<th>
|
||||
<label>状态</label>
|
||||
</th>
|
||||
<td>
|
||||
<div id="warn" id="cmdDesc"><i>检测状态中 ...</i></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="swap_usage_tr">
|
||||
<th>虚拟内存使用率</th>
|
||||
<td><% sysinfo("memory.swap.used"); %> / <% sysinfo("memory.swap.total"); %> MB</td>
|
||||
</tr>
|
||||
<tr id="swap_size_tr">
|
||||
<th width="35%">虚拟内存大小</th>
|
||||
<td>
|
||||
<select id="swap_size" name="swap_size" style="width:auto;margin:0px 0px 0px 2px;" class="ssconfig input_option">
|
||||
<option value="1">256M</option>
|
||||
<option value="2">512M 推荐</option>
|
||||
<option value="3">1G</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="apply_gen">
|
||||
<input class="button_gen" onclick="applyRule()" type="button" value="创建swap"/>
|
||||
<input class="button_gen" onclick="unload_swap()" type="button" value="删除swap"/>
|
||||
</div>
|
||||
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
|
||||
<div class="KoolshareBottom">
|
||||
<br/>论坛技术支持: <a href="http://www.koolshare.cn" target="_blank"> <i><u>www.koolshare.cn</u></i> </a> <br/>
|
||||
后台技术支持: <i>Xiaobao</i> <br/>
|
||||
Shell, Web by: <i>Sadoneli</i><br/>
|
||||
<br/>修改版 by: <i>paldier</i>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="10" align="center" valign="top"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
<div id="footer"></div>
|
||||
</body>
|
||||
</html>
|
2
swap/version
Normal file
2
swap/version
Normal file
@ -0,0 +1,2 @@
|
||||
2.2
|
||||
4ea389360d37f7ff9d2d4046b43be59b
|
Loading…
Reference in New Issue
Block a user