Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
ad8d2664
Commit
ad8d2664
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Tidying zram
parent
94053f6b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-vars
+8
-8
8 additions, 8 deletions
src/freedombone-vars
src/freedombone-zram
+19
-20
19 additions, 20 deletions
src/freedombone-zram
with
27 additions
and
28 deletions
src/freedombone-vars
+
8
−
8
View file @
ad8d2664
...
...
@@ -28,9 +28,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
DEFAULT_LANGUAGE
=
$(
echo
$LANG
)
DEFAULT_LANGUAGE
=
$LANG
if
[
!
$PROJECT_NAME
]
;
then
if
[
!
"
$PROJECT_NAME
"
]
;
then
PROJECT_NAME
=
'freedombone'
fi
...
...
@@ -81,24 +81,24 @@ ENABLE_SOCIAL_KEY_MANAGEMENT="no"
SOCIALINSTANCE
=
# include utils
UTILS_FILES
=
/usr/share/
${
PROJECT_NAME
}
/utils/
${
PROJECT_NAME
}
-utils-
*
UTILS_FILES
=
"
/usr/share/
${
PROJECT_NAME
}
/utils/
${
PROJECT_NAME
}
-utils-*
"
for
f
in
$UTILS_FILES
do
source
$f
source
"
$f
"
done
# include base system apps
BASE_SYSTEM_FILES
=
/usr/share/
${
PROJECT_NAME
}
/base/
${
PROJECT_NAME
}
-base-
*
BASE_SYSTEM_FILES
=
"
/usr/share/
${
PROJECT_NAME
}
/base/
${
PROJECT_NAME
}
-base-*
"
for
f
in
$BASE_SYSTEM_FILES
do
source
$f
source
"
$f
"
done
#include apps
APP_FILES
=
/usr/share/
${
PROJECT_NAME
}
/apps/
${
PROJECT_NAME
}
-app-
*
APP_FILES
=
"
/usr/share/
${
PROJECT_NAME
}
/apps/
${
PROJECT_NAME
}
-app-*
"
for
f
in
$APP_FILES
do
source
$f
source
"
$f
"
done
# optionally specify your name to appear on the blog
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-zram
+
19
−
20
View file @
ad8d2664
...
...
@@ -36,20 +36,19 @@ export TEXTDOMAINDIR="/usr/share/locale"
DAEMON_FILENAME
=
/etc/systemd/system/zram.service
function
zram_daemon
{
echo
'[Unit]'
>
$DAEMON_FILENAME
echo
'Description=Zeronet Server'
>>
$DAEMON_FILENAME
echo
'After=syslog.target'
>>
$DAEMON_FILENAME
echo
'After=network.target'
>>
$DAEMON_FILENAME
echo
'[Service]'
>>
$DAEMON_FILENAME
echo
'Type=simple'
>>
$DAEMON_FILENAME
echo
'User=zram'
>>
$DAEMON_FILENAME
echo
'Group=zram'
>>
$DAEMON_FILENAME
echo
'WorkingDirectory='
>>
$DAEMON_FILENAME
echo
"ExecStart=
${
PROJECT_NAME
}
-zram on"
>>
$DAEMON_FILENAME
echo
''
>>
$DAEMON_FILENAME
echo
'[Install]'
>>
$DAEMON_FILENAME
echo
'WantedBy=multi-user.target'
>>
$DAEMON_FILENAME
{
echo
'[Unit]'
;
echo
'Description=Zeronet Server'
;
echo
'After=syslog.target'
;
echo
'After=network.target'
;
echo
'[Service]'
;
echo
'Type=simple'
;
echo
'User=zram'
;
echo
'Group=zram'
;
echo
'WorkingDirectory='
;
echo
"ExecStart=
${
PROJECT_NAME
}
-zram on"
;
echo
''
;
echo
'[Install]'
;
echo
'WantedBy=multi-user.target'
;
}
>>
$DAEMON_FILENAME
}
function
zram_on
{
...
...
@@ -76,17 +75,17 @@ function zram_on {
# initialize the devices
for
i
in
$(
seq
0
$decr_num_cpus
)
;
do
echo
$((
mem_total
/
num_cpus
))
>
/sys/block/zram
$i
/disksize
echo
$((
mem_total
/
num_cpus
))
>
"
/sys/block/zram
$i
/disksize
"
done
# Creating swap filesystems
for
i
in
$(
seq
0
$decr_num_cpus
)
;
do
mkswap /dev/zram
$i
mkswap
"
/dev/zram
$i
"
done
# Switch the swaps on
for
i
in
$(
seq
0
$decr_num_cpus
)
;
do
swapon
-p
100 /dev/zram
$i
swapon
-p
100
"
/dev/zram
$i
"
done
zram_daemon
...
...
@@ -103,8 +102,8 @@ function zram_off {
# Switching off swap
for
i
in
$(
seq
0
$decr_num_cpus
)
;
do
if
[
"
$(
grep
/dev/zram
$i
/proc/swaps
)
"
!=
""
]
;
then
swapoff /dev/zram
$i
if
[
"
$(
grep
"
/dev/zram
$i
"
/proc/swaps
)
"
!=
""
]
;
then
swapoff
"
/dev/zram
$i
"
sleep
1
fi
done
...
...
@@ -123,7 +122,7 @@ function show_help {
exit
0
}
if
[
!
$1
]
;
then
if
[
!
"
$1
"
]
;
then
show_help
else
if
[[
"
$1
"
==
"on"
||
"
$1
"
==
"enable"
||
"
$1
"
==
"yes"
]]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment