mirror of
https://github.com/gutosie/neoboot.git
synced 2025-11-01 03:45:48 +01:00
Add files via upload
This commit is contained in:
@@ -1667,30 +1667,42 @@ class CreateSwap(Screen):
|
|||||||
def CreateSwap(self):
|
def CreateSwap(self):
|
||||||
if os.path.exists('/media/hdd/ImageBoot/.neonextboot'):
|
if os.path.exists('/media/hdd/ImageBoot/.neonextboot'):
|
||||||
if not os.path.exists('/media/hdd/swapfile'):
|
if not os.path.exists('/media/hdd/swapfile'):
|
||||||
cmd = ' swapoff /media/hdd/swapfile'
|
cmd0 = "echo -e '\n\n%s '" % _('Creation swap 512MB, please wait...')
|
||||||
cmd1 = 'dd if=/dev/zero of=/media/hdd/swapfile bs=1024 count=524288'
|
cmd1 = 'dd if=/dev/zero of=/media/hdd/swapfile bs=1024 count=524288'
|
||||||
cmd2 = 'mkswap /media/hdd/swapfile'
|
cmd2 = 'mkswap /media/hdd/swapfile'
|
||||||
cmd3 = 'swapon /media/hdd/swapfile'
|
cmd3 = 'swapon /media/hdd/swapfile'
|
||||||
cmd4 = 'echo "/media/hdd/swapfile swap swap defaults 0 0 " >> /etc/fstab'
|
cmd4 = 'echo "/media/hdd/swapfile swap swap defaults 0 0 " >> /etc/fstab'
|
||||||
cmd7 = 'touch /etc/init.d/rcS.local; chod 755 /etc/init.d/rcS.local'
|
cmd5 = 'echo "/sbin/swapon /hdd/swapfile; swapon -a " > /etc/init.d/rcS.local'
|
||||||
cmd6 = 'echo "/sbin/swapon /hdd/swapfile; swapon -a " > /etc/init.d/rcS.local'
|
cmd6 = 'chmod 755 /etc/init.d/rcS.local; /sbin/swapon /hdd/swapfile'
|
||||||
cmd7 = '/sbin/swapon /hdd/swapfile'
|
cmd7 = "echo -e '\n\n%s '" % _('Creation complete swap 512MB')
|
||||||
self.session.open(Console, _('NeoBoot....'), [cmd, cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, cmd7])
|
self.session.open(Console, _('NeoBoot....'), [cmd0,
|
||||||
self.close()
|
cmd1,
|
||||||
|
cmd2,
|
||||||
|
cmd3,
|
||||||
|
cmd4,
|
||||||
|
cmd5,
|
||||||
|
cmd6,
|
||||||
|
cmd7])
|
||||||
else:
|
else:
|
||||||
self.myClose(_('The file swapfile already exists!'))
|
self.myClose(_('The file swapfile already exists!'))
|
||||||
elif os.path.exists('/media/usb/ImageBoot/.neonextboot'):
|
elif os.path.exists('/media/usb/ImageBoot/.neonextboot'):
|
||||||
if not os.path.exists('/media/usb/swapfile'):
|
if not os.path.exists('/media/usb/swapfile'):
|
||||||
cmd = ' swapoff /media/usb/swapfile'
|
cmd0 = "echo -e '\n\n%s '" % _('Creation swap 512MB, please wait...')
|
||||||
cmd1 = 'dd if=/dev/zero of=/media/usb/swapfile bs=1024 count=524288'
|
cmd1 = 'dd if=/dev/zero of=/media/usb/swapfile bs=1024 count=524288'
|
||||||
cmd2 = 'mkswap /media/usb/swapfile'
|
cmd2 = 'mkswap /media/usb/swapfile'
|
||||||
cmd3 = 'swapon /media/usb/swapfile'
|
cmd3 = 'swapon /media/usb/swapfile'
|
||||||
cmd4 = 'echo "/media/usb/swapfile swap swap defaults 0 0 " >> /etc/fstab'
|
cmd4 = 'echo "/media/usb/swapfile swap swap defaults 0 0 " >> /etc/fstab'
|
||||||
cmd5 = 'touch /etc/init.d/rcS.local; chod 755 /etc/init.d/rcS.local'
|
cmd5 = 'echo "/sbin/swapon /usb/swapfile; swapon -a " > /etc/init.d/rcS.local'
|
||||||
cmd6 = 'echo "/sbin/swapon /usb/swapfile; swapon -a " > /etc/init.d/rcS.local'
|
cmd6 = 'chmod 755 /etc/init.d/rcS.local; /sbin/swapon /usb/swapfile'
|
||||||
cmd7 = '/sbin/swapon /usb/swapfile'
|
cmd7 = "echo -e '\n\n%s '" % _('Creation complete swap 512MB')
|
||||||
self.session.open(Console, _('NeoBoot....'), [cmd, cmd1, cmd2, cmd3, cmd4, cmd5, cmd6, cmd7])
|
self.session.open(Console, _('NeoBoot....'), [cmd0,
|
||||||
self.close()
|
cmd1,
|
||||||
|
cmd2,
|
||||||
|
cmd3,
|
||||||
|
cmd4,
|
||||||
|
cmd5,
|
||||||
|
cmd6,
|
||||||
|
cmd7])
|
||||||
else:
|
else:
|
||||||
self.myClose(_('The file swapfile already exists!'))
|
self.myClose(_('The file swapfile already exists!'))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user