From 8ad28c90a715e48c83a69e0b4f14a7d993f149e3 Mon Sep 17 00:00:00 2001 From: Kevin Puertas Date: Sat, 25 Mar 2017 17:59:59 +0100 Subject: [PATCH] Clean and delete python test --- installer/installer.sh | 1 - installer/prepare.sh | 52 ----------- installer/python/installer.py | 162 ---------------------------------- 3 files changed, 215 deletions(-) delete mode 100644 installer/prepare.sh delete mode 100644 installer/python/installer.py diff --git a/installer/installer.sh b/installer/installer.sh index d87d4bb..3fe6930 100755 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -64,7 +64,6 @@ function comm { echo "[ OK ] $1" echo "[ OK ] $1" >> /tmp/install.log fi - } function yesnobox { diff --git a/installer/prepare.sh b/installer/prepare.sh deleted file mode 100644 index ec9f903..0000000 --- a/installer/prepare.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -##Script that prepares a ArchLinux iso for installing JKArch -# Prepare system for install -echo "Dont run this" -exit -if [[ ! -f "jkarch" ]];then - #Prepare system before install - dialog --title "JKArch install script" --msgbox "Starting installation, please wait" 15 60 - # First add exec permisson to me - chmod +x installer.sh - # Grow cowspace - comm "Grow cowspace for installer" "1" "sudo" "mount -o remount,size=700M /run/archiso/cowspace" - - #Enable pacman - pacman-key --init - pacman-key --populate - pacman -Sy archlinux-keyring --noconfirm - - pacman -S reflector --noconfirm - reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist - - #Delete programs (For not updating it) - sudo pacman -R clonezilla darkhttpd diffutils grml-zsh-config irssi linux-atm lvm2 man-db man-pages mc ndisc6 nmap smartmontools testdisk vi vim vim-runtime openconnect pcsclite python2 --noconfirm - sudo rm -rf /var/cache/pacman/pkg/* - - #Needed progs (gparted,python) - sudo pacman -S gparted xf86-video-vesa xorg-xinit lwm xorg-xrandr xterm --noconfirm --needed - sudo rm -rf /var/cache/pacman/pkg/* - sudo pacman -S python python-pythondialog --noconfirm --needed - sudo rm -rf /var/cache/pacman/pkg/* - #Update progs - sudo pacman -Su --noconfirm --ignore linux #Do not upgrade kernel automatically - sudo rm -rf /var/cache/pacman/pkg/* - sudo rm /etc/X11/xinit/xinitrc - sudo touch /etc/X11/xinit/xinitrc - sudo chmod 777 /etc/X11/xinit/xinitrc - sudo echo "#Start gparted with startx command" > /etc/X11/xinit/xinitrc - sudo echo "lwm &" >> /etc/X11/xinit/xinitrc - sudo echo "xrandr -s 1024x768 -r 60" >> /etc/X11/xinit/xinitrc - sudo echo "xterm -e '/usr/bin/python3 /root/installer.py' -geometry 120x35" >> /etc/X11/xinit/xinitrc - sudo chmod 644 /etc/X11/xinit/xinitrc - sudo rm -rf /var/cache/pacman/pkg/* - - # No black screensaver - setterm -blank 0 -powerdown 0 -powersave off - - # System prepared, now start installer - touch /root/jkarch - startx - #Exit this. - exit -fi \ No newline at end of file diff --git a/installer/python/installer.py b/installer/python/installer.py deleted file mode 100644 index 48aff75..0000000 --- a/installer/python/installer.py +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/python -## This script requires ArchLinux and: python3 and python-pythondialog, or python2, python2-pythondialog and python2-future - -###### THIS SCRIPT NOT WORKS, ITS A TRY, THANKS ###### -print ('\033[91m'+"Dont run this."+'\033[0m') -sys.exit(0) - - -#General imports (Python2 and 3) -import os,sys,subprocess - -#Install and delete things, preparing installer -subprocess.call("mount -o remount,size=700M /run/archiso/cowspace", shell=True) -subprocess.call("pacman-key --init && pacman-key --populate && pacman -Sy archlinux-keyring --noconfirm", shell=True) -subprocess.call("pacman -S reflector --noconfirm && reflector --verbose -l 6 --sort rate --save /etc/pacman.d/mirrorlist", shell=True) -subprocess.call("pacman -R clonezilla darkhttpd diffutils grml-zsh-config irssi linux-atm lvm2 man-db man-pages mc ndisc6 nmap smartmontools testdisk vi vim vim-runtime openconnect pcsclite --noconfirm", shell=True) -subprocess.call("rm -rf /var/cache/pacman/pkg/*", shell=True) -subprocess.call("pacman -Su --noconfirm --ignore linux", shell=True) -subprocess.call("rm -rf /var/cache/pacman/pkg/*", shell=True) -subprocess.call("pacman -S gparted xf86-video-vesa xorg-xinit lwm xorg-xrandr xterm --noconfirm --needed", shell=True) -subprocess.call("rm -rf /var/cache/pacman/pkg/*", shell=True) -subprocess.call("rm /etc/X11/xinit/xinitrc", shell=True) -subprocess.call("touch /etc/X11/xinit/xinitrc", shell=True) -subprocess.call("chmod 777 /etc/X11/xinit/xinitrc", shell=True) -subprocess.call('echo "#Start gparted with startx command" > /etc/X11/xinit/xinitrc', shell=True) -subprocess.call('echo "lwm &" >> /etc/X11/xinit/xinitrc', shell=True) -subprocess.call('echo "xrandr -s 1024x768 -r 60" >> /etc/X11/xinit/xinitrc', shell=True) -subprocess.call('chmod 644 /etc/X11/xinit/xinitrc', shell=True) - -### sudo echo "xterm -e '/usr/bin/python3 /root/installer.py' -geometry 120x35" >> /etc/X11/xinit/xinitrc - - - -#Try to see if its using python2 -pythonver=sys.version_info[0] -if pythonver < 3: - print 'You are using python2, installing needed things..' - subprocess.call("pacman -S python2-future python2-pythondialog --noconfirm --needed", shell=True) - #Import future for using python3 syntax in python2 - from __future__ import (absolute_import, division, print_function, unicode_literals) - from builtins import * -else: - print 'You are using python3, installing needed things..' - subprocess.call("pacman -S python-pythondialog --noconfirm --needed", shell=True) - - -#Things installed, running... - -from dialog import Dialog -dialog = Dialog(dialog="dialog") -FNULL = open(os.devnull, 'w') - -# Import colors for printing -class bcolors: - PNK = '\033[95m' # Pink - BLU = '\033[94m' # Blue - GRE = '\033[92m' # Green - YEL = '\033[93m' # Yellow - RED = '\033[91m' # Red - END = '\033[0m' # Default? - - def disable(self): - self.PNK = '' - self.BLU = '' - self.GRE = '' - self.YEL = '' - self.RED = '' - self.END = '' - -# Function to pause program to wait for the user -def pause(): - input('Press to continue') - -# Exec command, returns status of command -def execC(command,out="",err=""): - #Example: execC('ls -l') - if out == "" and err == "": - return subprocess.call(command, shell=True) - elif out != "" and err == "": - return subprocess.call(command, shell=True, stdout=out) - elif out != "" and err != "": - return subprocess.call(command, shell=True, stdout=out, stderr=err) - -# This funcion clears screen -def clear(): - os.system('cls' if os.name == 'nt' else 'clear') - -# This funcion show a "dialog-like" message -def mostrardialog(title,msg): - #Example: mostrardialog("Titulo","Mensaje") - dialog.set_background_title("JKArch installer") - res = dialog.msgbox(msg, title=title) - clear() - return res - -# This function shows a yesnobox that return a dialog.OK or dialog.CANCEL -def yesnobox(msg): - #Example: response = yesnobox("¿Estás de acuerdo?") - dialog.set_background_title("JKArch installer") - res = dialog.yesno(msg) - clear() - return res - -def menudialog(title,options): - #Example: res = menudialog("Elige",[("Li","Linux","W","Windows")]) - code, tag = dialog.menu("Some text that will be displayed above the menu entries", choices=options) - clear() - return tag - -# This function runs a command and shows result. Also can be silent or not silent -# multicmd is 0 as unique, 1 as first, 2 as middle, and 3 as last -# runas can be sudo, chroot, and chuser -# If silent = 0 -> show all; 1 -> silent command; 2 -> Output good ever (And silent) -def comm(msg,silent,runas,command,multicmd=0): - #Example: comm("Directory list",0,"sudo","ls -l") - if runas == "chroot": - command="chroot /mnt /bin/bash -c \""+command+"\"" - elif runas == "chuser": - command="chroot /mnt /bin/bash -c \"su $nameuser -c \""+command+"\" \" " - if multicmd == 0 or multicmd == 1: - print ("[RUNNING] " + msg) - if silent == 0: - statusC = execC(command) - elif silent == 1: - statusC = execC(command,FNULL) - elif silent == 2: - statusC = execC(command,FNULL,FNULL) - - if (statusC == 0 or silent == 2) and (multicmd == 0 or multicmd == 3): - print ("["+bcolors.GRE +" OK "+bcolors.END +"] " + msg) - elif statusC != 0: - print ("["+bcolors.RED +"FAILED"+bcolors.END +"] " + msg) - - -comm("Directory list",0,"sudo","ls -l") -comm("Directory list",1,"sudo","ls -l") -response = yesnobox("¿Estás de acuerdo con usar Python?") -if response == dialog.OK: - print ("Estas avisado.") - - - - -###Start install -sclang = menudialog("Selecciona el idioma",[("es","Español","en","Ingles")]) -execC("loadkeys "+sclang,FNULL,FNULL) -comm("Desmontando particiones",2,"sudo","umount /mnt/*/* & umount /mnt/* & umount /mnt") -usr_partitions -usr_date -usr_selectapps -usr_userpass - -## TODO RESUMEN ## - -installconf - -usr_otheropts - -mostrardialog("End","Setup finished, press enter to reboot") -execC("mv /tmp/install.log /mnt/home/$nameuser/install.log",FNULL) -comm("Desmontando particiones",2,"sudo","umount /mnt/*/* & umount /mnt/* & umount /mnt") -execC("reboot") \ No newline at end of file