We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64ce669 commit a16843aCopy full SHA for a16843a
platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init
@@ -11,6 +11,26 @@
11
# Short-Description: Setup Haliburton board.
12
### END INIT INFO
13
14
+setup_swap () {
15
+ SWAPFILE=/host/myswapfile
16
+
17
+ if [ ! -f $SWAPFILE ]; then
18
+ availspace=`df -h --output=avail /host | sed '1d;s/\s//g;s/[^0-9].*//g'`
19
+ diff=$(( availspace - 2*$1 ))
20
+ if [ $diff -gt 0 ]; then
21
+ fallocate -l ${1}G $SWAPFILE
22
+ chmod 600 $SWAPFILE
23
+ echo "swap file created successfully"
24
+ else
25
+ echo "not enough disk space to turn on swap."
26
+ return
27
+ fi
28
29
+ mkswap $SWAPFILE
30
+ swapon $SWAPFILE
31
+ echo "swap on successfully"
32
+}
33
34
case "$1" in
35
start)
36
echo -n "Setting up board... "
@@ -74,6 +94,8 @@ start)
74
94
75
95
/bin/sh /usr/local/bin/platform_api_mgnt.sh init
76
96
97
+ setup_swap 2
98
77
99
echo "done."
78
100
;;
79
101
0 commit comments